From ef81aeb4637eabfbbf56990bb897a795be5a99d1 Mon Sep 17 00:00:00 2001 From: shaw Date: Fri, 19 Dec 2025 22:41:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Ddashboard=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=94=A8=E6=88=B7=E5=90=8D=E7=9A=84=E6=98=BE=E7=A4=BA?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/types/index.ts | 2 +- frontend/src/views/admin/DashboardView.vue | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.ts index 715b7e4e..715c36d2 100644 --- a/frontend/src/types/index.ts +++ b/frontend/src/types/index.ts @@ -541,7 +541,7 @@ export interface ModelStat { export interface UserUsageTrendPoint { date: string; user_id: number; - username: string; + email: string; requests: number; tokens: number; cost: number; // 标准计费 diff --git a/frontend/src/views/admin/DashboardView.vue b/frontend/src/views/admin/DashboardView.vue index 2985a9f4..29b2f6b1 100644 --- a/frontend/src/views/admin/DashboardView.vue +++ b/frontend/src/views/admin/DashboardView.vue @@ -462,13 +462,21 @@ const trendChartData = computed(() => { const userTrendChartData = computed(() => { if (!userTrend.value?.length) return null + // Extract display name from email (part before @) + const getDisplayName = (email: string, userId: number): string => { + if (email && email.includes('@')) { + return email.split('@')[0] + } + return `User #${userId}` + } + // Group by user const userGroups = new Map }>() const allDates = new Set() userTrend.value.forEach(point => { allDates.add(point.date) - const key = point.username || `User #${point.user_id}` + const key = getDisplayName(point.email, point.user_id) if (!userGroups.has(key)) { userGroups.set(key, { name: key, data: new Map() }) }