From e67dbbdb8a6c05a3933209c61d6b39262866e476 Mon Sep 17 00:00:00 2001 From: ianshaw Date: Sun, 4 Jan 2026 21:10:52 -0800 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20=E6=81=A2=E5=A4=8D=20UsageTabl?= =?UTF-8?q?e=20=E7=BC=BA=E5=A4=B1=E7=9A=84=E5=88=97=E5=92=8C=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 恢复 API Key、账号、分组、类型、计费类型等列 - 恢复 Token 详情显示(含缓存读写) - 恢复首Token时间、耗时列 - 恢复请求ID列及复制功能 --- .../src/components/admin/usage/UsageTable.vue | 163 ++++++++++++++++-- 1 file changed, 147 insertions(+), 16 deletions(-) diff --git a/frontend/src/components/admin/usage/UsageTable.vue b/frontend/src/components/admin/usage/UsageTable.vue index 91e71e42..63694925 100644 --- a/frontend/src/components/admin/usage/UsageTable.vue +++ b/frontend/src/components/admin/usage/UsageTable.vue @@ -1,22 +1,153 @@ \ No newline at end of file + +const formatCacheTokens = (tokens: number): string => { + if (tokens >= 1000000) return `${(tokens / 1000000).toFixed(1)}M` + if (tokens >= 1000) return `${(tokens / 1000).toFixed(1)}K` + return tokens.toString() +} + +const formatDuration = (ms: number | null | undefined): string => { + if (ms == null) return '-' + if (ms < 1000) return `${ms}ms` + return `${(ms / 1000).toFixed(2)}s` +} + +const copyRequestId = async (requestId: string) => { + try { + await navigator.clipboard.writeText(requestId) + copiedRequestId.value = requestId + appStore.showSuccess(t('admin.usage.requestIdCopied')) + setTimeout(() => { copiedRequestId.value = null }, 2000) + } catch { + appStore.showError(t('common.copyFailed')) + } +} +