refactor(dashboard): switch usage charts to route group_by, rename Models card

Align dashboard with the route dimension introduced in the previous
commit:

* Token Usage / API Requests pie charts query the breakdown API with
  `group_by: ['date', 'route']` and aggregate via the new `route`
  dimension in `buildUsageLabel`. Visible chart titles keep the existing
  "by Model" wording — only the underlying data dim changed.
* Overview "Models" card label switched to `dashboard.deployments`
  ("部署" / "Deployments"), and the Active Models table heading to
  `dashboard.activeDeployments`. These reflect the underlying entity
  (model deployments) more accurately now that routes are the
  user-facing model concept.
* Drop 11 unused dashboard locale keys (`dashboard.title`,
  `dashboard.models`, `dashboard.allocategpus`, `dashboard.instances`,
  `dashboard.disk`, `dashboard.diskutilization`, `dashboard.apirequest`,
  `dashboard.activeModels`, `dashboard.activeUsers`,
  `dashboard.activeModels.name`, `dashboard.runninginstances`) — no
  remaining references in `src/` after the rename. Locale parity check
  passes.
This commit is contained in:
Yuxing Deng
2026-05-19 16:50:42 +08:00
parent 38107a67fe
commit 44e5b78d29
10 changed files with 26 additions and 62 deletions
@@ -106,7 +106,7 @@ const ActiveTable = () => {
fontWeight: 'var(--font-weight-bold)'
}}
>
{intl.formatMessage({ id: 'dashboard.activeModels' })}
{intl.formatMessage({ id: 'dashboard.activeDeployments' })}
</span>
}
right={false}
+1 -1
View File
@@ -51,7 +51,7 @@ const NewUsage = () => {
tokenByModelQuery.fetchData({
...commonParams,
metric: 'total_tokens',
group_by: ['date', 'model'],
group_by: ['date', 'route'],
sort_by: '-total_tokens'
})
]);
@@ -27,7 +27,7 @@ const ApiRequestsByModel: React.FC<ApiRequestsByModelProps> = ({
.fetchData({
...commonParams,
metric: 'api_requests',
group_by: ['date', 'model'],
group_by: ['date', 'route'],
page: 1,
perPage: 10,
sort_by: '-api_requests'
@@ -36,7 +36,7 @@ const ApiRequestsByModel: React.FC<ApiRequestsByModelProps> = ({
}, [commonParams]);
const chartData = useMemo(
() => toUsagePieData(query.detailData, 'model', 'api_requests'),
() => toUsagePieData(query.detailData, 'route', 'api_requests'),
[query.detailData]
);
@@ -21,7 +21,7 @@ const TokenUsageByModel: React.FC<TokenUsageByModelProps> = ({
const intl = useIntl();
const chartData = useMemo(
() => toUsagePieData(data, 'model', 'total_tokens'),
() => toUsagePieData(data, 'route', 'total_tokens'),
[data]
);
+11 -2
View File
@@ -22,7 +22,7 @@ export const overviewConfigs = [
{
key: 'model_count',
label: 'dashboard.models',
label: 'dashboard.deployments',
backgroundColor: 'var(--color-white-1)'
},
{
@@ -41,7 +41,7 @@ export const baseColorMap = {
baseR3: 'rgba(85,167,255,0.8)'
};
export type UsageGroupBy = 'model' | 'user' | 'api_key';
export type UsageGroupBy = 'model' | 'route' | 'user' | 'api_key';
export type UsageMetric = 'total_tokens' | 'api_requests';
export interface UsageChartDatum {
@@ -104,6 +104,15 @@ export const buildUsageLabel = (item: BreakdownItem, groupBy: UsageGroupBy) => {
return groupItem?.label || modelName || '-';
}
if (groupBy === 'route') {
return (
groupItem?.label ||
identityValue?.route_name ||
groupValue?.route_name ||
'-'
);
}
return (
groupItem?.label ||
identityValue?.user_name ||