From 62b40636e09f58755c297d6d30feb7aac97c6502 Mon Sep 17 00:00:00 2001 From: Ethan0x0000 <3352979663@qq.com> Date: Tue, 17 Mar 2026 19:26:48 +0800 Subject: [PATCH] feat(frontend): display upstream model in usage table and distribution charts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Show upstream model mapping (requested -> upstream) in UsageTable with arrow notation. Add requested/upstream/mapping source toggle to ModelDistributionChart with lazy loading — only fetches data when user switches tab, with per-source cache invalidation on filter changes. Include upstream_model column in Excel export and i18n for en/zh. --- frontend/src/api/admin/dashboard.ts | 2 + .../src/components/admin/usage/UsageTable.vue | 12 +- .../charts/EndpointDistributionChart.vue | 4 +- .../charts/ModelDistributionChart.vue | 59 +++++++++- frontend/src/i18n/locales/en.ts | 3 + frontend/src/i18n/locales/zh.ts | 3 + frontend/src/types/index.ts | 1 + frontend/src/views/admin/UsageView.vue | 111 ++++++++++++++++-- 8 files changed, 177 insertions(+), 18 deletions(-) diff --git a/frontend/src/api/admin/dashboard.ts b/frontend/src/api/admin/dashboard.ts index 0bf0a2c5..15d1540f 100644 --- a/frontend/src/api/admin/dashboard.ts +++ b/frontend/src/api/admin/dashboard.ts @@ -81,6 +81,7 @@ export interface ModelStatsParams { user_id?: number api_key_id?: number model?: string + model_source?: 'requested' | 'upstream' | 'mapping' account_id?: number group_id?: number request_type?: UsageRequestType @@ -162,6 +163,7 @@ export interface UserBreakdownParams { end_date?: string group_id?: number model?: string + model_source?: 'requested' | 'upstream' | 'mapping' endpoint?: string endpoint_type?: 'inbound' | 'upstream' | 'path' limit?: number diff --git a/frontend/src/components/admin/usage/UsageTable.vue b/frontend/src/components/admin/usage/UsageTable.vue index aa6c2bbd..4a42ab05 100644 --- a/frontend/src/components/admin/usage/UsageTable.vue +++ b/frontend/src/components/admin/usage/UsageTable.vue @@ -25,8 +25,16 @@ {{ row.account?.name || '-' }} -