-
Notifications
You must be signed in to change notification settings - Fork 328
[front] feat: wire Models tab of the usage filter panel to real, period-scoped data #30170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
avervaet
merged 5 commits into
main
from
avervaet/wiring-usage-filter-component-models-tab
Aug 11, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1e8db1b
[front] feat: wire Models tab of the usage filter panel to real, peri…
avervaet dfc9560
[front] fix: list every model in the usage filter panel, not just the…
avervaet 30690a6
Update front/components/workspace/analytics/usageFilter.ts
avervaet deaad8a
fixing test
avervaet f2d68c8
fix
avervaet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| import type { ConsumptionScopeFilter } from "@app/lib/api/analytics/consumption/scope"; | ||
| import type { ModelsTierName } from "@app/lib/api/assistant/token_pricing/tiers"; | ||
| import type { AgentConfigurationScope } from "@app/types/assistant/agent"; | ||
| import type { ModelMakerIdType } from "@app/types/assistant/models/types"; | ||
| import type { ConnectorProvider } from "@app/types/data_source"; | ||
| import { assertNeverAndIgnore } from "@app/types/shared/utils/assert_never"; | ||
|
|
||
| export const USAGE_FILTER_CATEGORIES = [ | ||
| "agent", | ||
|
|
@@ -71,7 +73,10 @@ export interface UsageFilterSourceOption extends UsageFilterOptionBase { | |
| export interface UsageFilterModelOption extends UsageFilterOptionBase { | ||
| kind: "model"; | ||
| lab: ModelMakerIdType; | ||
| tier: UsageModelTier; | ||
| // Undefined for a model outside the static tier table — it doesn't match | ||
| // any Fast/Standard/Complex quick filter, so it's absent from the main | ||
| // checklist but still reachable through the "More models" browse dropdown. | ||
| tier: UsageModelTier | undefined; | ||
| } | ||
|
|
||
| export interface UsageFilterToolOption extends UsageFilterOptionBase { | ||
|
|
@@ -146,8 +151,9 @@ export function selectAllUsageFilterOptions<C extends UsageFilterCategory>( | |
| return { ...filter, [category]: [...current, ...additions] }; | ||
| } | ||
|
|
||
| // Members, teams, and agents are wired to real consumption scope dimensions. | ||
| // The other categories stay mock data and are not sent as query filters yet. | ||
| // Members, teams, agents, and models are wired to real consumption scope | ||
| // dimensions. The other categories stay mock data and are not sent as query | ||
| // filters yet. | ||
| export function toConsumptionScopeFilter( | ||
| filter: UsageFilter | ||
| ): ConsumptionScopeFilter { | ||
|
|
@@ -168,5 +174,34 @@ export function toConsumptionScopeFilter( | |
| scopeFilter.agents = agentIds; | ||
| } | ||
|
|
||
| const modelIds = filter.model?.map((entity) => entity.id); | ||
| if (modelIds && modelIds.length > 0) { | ||
| scopeFilter.models = modelIds; | ||
| } | ||
|
|
||
| return scopeFilter; | ||
| } | ||
|
|
||
| // Maps the backend's reasoning-effort-aware pricing tier onto the filter | ||
| // panel's simpler Fast/Standard/Complex bucket. Null propagates (a model | ||
| // outside the static tier table, or a raw catalog entry with no config match) | ||
| // as "no bucket", so it's excluded from every quick-filter tier rather than | ||
| // landing in one arbitrarily. | ||
| export function usageModelTierFromModelsTierName( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. probably needs some alignment with what we're doing with the model picker, we should not introduce a new wording users are not familiar with here |
||
| tier: ModelsTierName | null | undefined | ||
| ): UsageModelTier | undefined { | ||
| if (tier === null || tier === undefined) { | ||
| return undefined; | ||
| } | ||
| switch (tier) { | ||
| case "cost_efficient": | ||
| return "fast"; | ||
| case "balanced": | ||
| return "standard"; | ||
| case "premium": | ||
| return "complex"; | ||
| default: | ||
|
avervaet marked this conversation as resolved.
|
||
| assertNeverAndIgnore(tier); | ||
| return undefined; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be discussed @flvndvd @ClementAupiais.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
material: #29299