refactor(usage): switch breakdown dimension from model to route
Align with gpustack backend commits 7b57cd3b (add route dimension to
usage breakdown) and 51fd25c8 (use model_route_id as models_called):
* group_by, filters, and BreakdownItem now use the `route` dimension;
`models` filter cascader is replaced with a flat `routes` selector
(routes have no provider/cluster grouping).
* Tab / group_by option / column header keep the user-facing "模型 / Model"
wording — only the underlying data dimension changed.
* Drop cluster_name / provider_type columns from the breakdown table;
drop api_keys_used column per design.
* Fix pre-existing excel export bug in use-export-table — string
dataIndex was lodash-joined char-by-char ("input_tokens" →
"i_n_p_u_t..."), array dataIndex was used as a flat key against nested
rows. Rebuilt around buildSheetMeta that emits a stable field key plus
a formatMap using _.get(row, path) for nested values. Sheet name kept
as `models` to match the visible column label.
This commit is contained in:
@@ -6,7 +6,7 @@ export const groupByOptions = [
|
||||
// label: 'None'
|
||||
// },
|
||||
{
|
||||
value: 'model',
|
||||
value: 'route',
|
||||
label: 'usage.filter.group.model'
|
||||
},
|
||||
{
|
||||
|
||||
@@ -9,11 +9,13 @@ export interface UsageFilterItem {
|
||||
api_key_is_custom: boolean | null;
|
||||
provider_type: string | null;
|
||||
provider_name: string | null;
|
||||
route_name: string | null;
|
||||
};
|
||||
current: {
|
||||
model_id: string | null;
|
||||
user_id: number | null;
|
||||
api_key_id: string | null;
|
||||
route_id: number | null;
|
||||
};
|
||||
};
|
||||
label: string;
|
||||
@@ -63,6 +65,7 @@ export type BreakdownItem = {
|
||||
provider_name: string;
|
||||
user: UsageFilterItem;
|
||||
model: UsageFilterItem;
|
||||
route: UsageFilterItem;
|
||||
api_key: UsageFilterItem;
|
||||
date: {
|
||||
value: string;
|
||||
@@ -88,6 +91,7 @@ export interface UsageMeta {
|
||||
models: UsageFilterItem[];
|
||||
users: UsageFilterItem[];
|
||||
api_keys: UsageFilterItem[];
|
||||
routes: UsageFilterItem[];
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user