fix: 修复仪表盘Keys统计展示问题

This commit is contained in:
shaw
2025-08-23 08:55:52 +08:00
parent 86aff0a273
commit e4e72ba5e9

View File

@@ -982,7 +982,7 @@ function createApiKeysUsageTrendChart() {
} }
const data = apiKeysTrendData.value.data || [] const data = apiKeysTrendData.value.data || []
const metric = apiKeysTrendMetric const metric = apiKeysTrendMetric.value
// 颜色数组 // 颜色数组
const colors = [ const colors = [
@@ -1104,7 +1104,7 @@ function createApiKeysUsageTrendChart() {
else if (rank === 2) rankIcon = '🥈 ' else if (rank === 2) rankIcon = '🥈 '
else if (rank === 3) rankIcon = '🥉 ' else if (rank === 3) rankIcon = '🥉 '
if (apiKeysTrendMetric === 'tokens') { if (apiKeysTrendMetric.value === 'tokens') {
// 格式化token显示 // 格式化token显示
let formattedValue = '' let formattedValue = ''
if (value >= 1000000) { if (value >= 1000000) {
@@ -1148,7 +1148,7 @@ function createApiKeysUsageTrendChart() {
beginAtZero: true, beginAtZero: true,
title: { title: {
display: true, display: true,
text: apiKeysTrendMetric === 'tokens' ? 'Token 数量' : '请求次数', text: apiKeysTrendMetric.value === 'tokens' ? 'Token 数量' : '请求次数',
color: chartColors.value.text color: chartColors.value.text
}, },
ticks: { ticks: {
@@ -1168,7 +1168,7 @@ function createApiKeysUsageTrendChart() {
// 更新API Keys使用趋势图 // 更新API Keys使用趋势图
async function updateApiKeysUsageTrendChart() { async function updateApiKeysUsageTrendChart() {
await loadApiKeysTrend(apiKeysTrendMetric) await loadApiKeysTrend(apiKeysTrendMetric.value)
await nextTick() await nextTick()
createApiKeysUsageTrendChart() createApiKeysUsageTrendChart()
} }