diff --git a/web/admin-spa/src/i18n/locales/en.js b/web/admin-spa/src/i18n/locales/en.js index ecec84d6..52bf99cc 100644 --- a/web/admin-spa/src/i18n/locales/en.js +++ b/web/admin-spa/src/i18n/locales/en.js @@ -215,5 +215,106 @@ export default { passwordPlaceholder: 'Please enter password', loginButton: 'Login', loggingIn: 'Logging in...' + }, + + // Dashboard page + dashboard: { + // Main stats cards + totalApiKeys: 'Total API Keys', + activeApiKeys: 'Active', + serviceAccounts: 'Service Accounts', + normalAccounts: 'Normal', + abnormalAccounts: 'Abnormal', + pausedAccounts: 'Paused', + rateLimitedAccounts: 'Rate Limited', + todayRequests: 'Today Requests', + totalRequests: 'Total Requests', + systemStatus: 'System Status', + uptime: 'Uptime', + + // Platform accounts tooltip + claudeAccount: 'Claude: {total} accounts (Normal: {normal})', + consoleAccount: 'Console: {total} accounts (Normal: {normal})', + geminiAccount: 'Gemini: {total} accounts (Normal: {normal})', + bedrockAccount: 'Bedrock: {total} accounts (Normal: {normal})', + openaiAccount: 'OpenAI: {total} accounts (Normal: {normal})', + azureOpenaiAccount: 'Azure OpenAI: {total} accounts (Normal: {normal})', + + // Token stats cards + todayToken: 'Today Tokens', + totalTokenConsumption: 'Total Token Consumption', + inputTokens: 'Input', + outputTokens: 'Output', + cacheCreateTokens: 'Cache Create', + cacheReadTokens: 'Cache Read', + + // Real-time metrics + realtimeRPM: 'Realtime RPM', + realtimeTPM: 'Realtime TPM', + requestsPerMinute: 'Requests per Minute', + tokensPerMinute: 'Tokens per Minute', + historicalData: 'Historical Data', + minutes: 'minutes', + + // Charts section + modelDistributionAndTrend: 'Model Usage Distribution & Token Usage Trends', + + // Date filter presets + today: 'Today', + yesterday: 'Yesterday', + last7Days: 'Last 7 Days', + last30Days: 'Last 30 Days', + thisWeek: 'This Week', + lastWeek: 'Last Week', + thisMonth: 'This Month', + lastMonth: 'Last Month', + + // Granularity buttons + byDay: 'By Day', + byHour: 'By Hour', + + // Date picker + startDatePlaceholder: 'Start Date', + endDatePlaceholder: 'End Date', + dateSeparator: 'to', + maxHours24: 'Maximum 24 hours', + + // Auto refresh controls + autoRefresh: 'Auto Refresh', + refresh: 'Refresh', + refreshing: 'Refreshing', + refreshDataNow: 'Refresh data now', + + // Charts + tokenUsageDistribution: 'Token Usage Distribution', + detailedStatistics: 'Detailed Statistics', + noModelUsageData: 'No model usage data available', + + // Table headers + model: 'Model', + requestCount: 'Requests', + totalTokens: 'Total Tokens', + cost: 'Cost', + percentage: 'Percentage', + + // Trend charts + tokenUsageTrend: 'Token Usage Trend', + apiKeysUsageTrend: 'API Keys Usage Trend', + requestsCount: 'Requests Count', + tokenCount: 'Token Count', + totalApiKeysCount: 'Total {count} API Keys', + showingTop10: 'Total {count} API Keys, showing top 10 by usage', + + // Chart labels + inputTokensLabel: 'Input Tokens', + outputTokensLabel: 'Output Tokens', + cacheCreateTokensLabel: 'Cache Create Tokens', + cacheReadTokensLabel: 'Cache Read Tokens', + costLabel: 'Cost (USD)', + requestsLabel: 'Requests', + time: 'Time', + date: 'Date', + tokenQuantity: 'Token Quantity', + requestsQuantity: 'Requests Count' } } diff --git a/web/admin-spa/src/i18n/locales/zh-cn.js b/web/admin-spa/src/i18n/locales/zh-cn.js index 50fbda09..a7be4244 100644 --- a/web/admin-spa/src/i18n/locales/zh-cn.js +++ b/web/admin-spa/src/i18n/locales/zh-cn.js @@ -215,5 +215,106 @@ export default { passwordPlaceholder: '请输入密码', loginButton: '登录', loggingIn: '登录中...' + }, + + // Dashboard page + dashboard: { + // Main stats cards + totalApiKeys: '总 API Keys', + activeApiKeys: '活跃', + serviceAccounts: '服务账户', + normalAccounts: '正常', + abnormalAccounts: '异常', + pausedAccounts: '停止调度', + rateLimitedAccounts: '限流', + todayRequests: '今日请求', + totalRequests: '总请求', + systemStatus: '系统状态', + uptime: '运行时间', + + // Platform accounts tooltip + claudeAccount: 'Claude: {total} 个 (正常: {normal})', + consoleAccount: 'Console: {total} 个 (正常: {normal})', + geminiAccount: 'Gemini: {total} 个 (正常: {normal})', + bedrockAccount: 'Bedrock: {total} 个 (正常: {normal})', + openaiAccount: 'OpenAI: {total} 个 (正常: {normal})', + azureOpenaiAccount: 'Azure OpenAI: {total} 个 (正常: {normal})', + + // Token stats cards + todayToken: '今日Token', + totalTokenConsumption: '总Token消耗', + inputTokens: '输入', + outputTokens: '输出', + cacheCreateTokens: '缓存创建', + cacheReadTokens: '缓存读取', + + // Real-time metrics + realtimeRPM: '实时RPM', + realtimeTPM: '实时TPM', + requestsPerMinute: '每分钟请求数', + tokensPerMinute: '每分钟Token数', + historicalData: '历史数据', + minutes: '分钟', + + // Charts section + modelDistributionAndTrend: '模型使用分布与Token使用趋势', + + // Date filter presets (would be populated from dateFilter.presetOptions) + today: '今日', + yesterday: '昨日', + last7Days: '迗 7 天', + last30Days: '迗 30 天', + thisWeek: '本周', + lastWeek: '上周', + thisMonth: '本月', + lastMonth: '上月', + + // Granularity buttons + byDay: '按天', + byHour: '按小时', + + // Date picker + startDatePlaceholder: '开始日期', + endDatePlaceholder: '结束日期', + dateSeparator: '至', + maxHours24: '最多24小时', + + // Auto refresh controls + autoRefresh: '自动刷新', + refresh: '刷新', + refreshing: '刷新中', + refreshDataNow: '立即刷新数据', + + // Charts + tokenUsageDistribution: 'Token使用分布', + detailedStatistics: '详细统计数据', + noModelUsageData: '暂无模型使用数据', + + // Table headers + model: '模型', + requestCount: '请求数', + totalTokens: '总Token', + cost: '费用', + percentage: '占比', + + // Trend charts + tokenUsageTrend: 'Token使用趋势', + apiKeysUsageTrend: 'API Keys 使用趋势', + requestsCount: '请求次数', + tokenCount: 'Token 数量', + totalApiKeysCount: '共 {count} 个 API Key', + showingTop10: '共 {count} 个 API Key,显示使用量前 10 个', + + // Chart labels + inputTokensLabel: '输入Token', + outputTokensLabel: '输出Token', + cacheCreateTokensLabel: '缓存创建Token', + cacheReadTokensLabel: '缓存读取Token', + costLabel: '费用 (USD)', + requestsLabel: '请求数', + time: '时间', + date: '日期', + tokenQuantity: 'Token数量', + requestsQuantity: '请求次数' } } diff --git a/web/admin-spa/src/i18n/locales/zh-tw.js b/web/admin-spa/src/i18n/locales/zh-tw.js index df3c1186..b4e61a50 100644 --- a/web/admin-spa/src/i18n/locales/zh-tw.js +++ b/web/admin-spa/src/i18n/locales/zh-tw.js @@ -215,5 +215,106 @@ export default { passwordPlaceholder: '請輸入密碼', loginButton: '登錄', loggingIn: '登錄中...' + }, + + // Dashboard page + dashboard: { + // Main stats cards + totalApiKeys: '總 API Keys', + activeApiKeys: '活躍', + serviceAccounts: '服務帳戶', + normalAccounts: '正常', + abnormalAccounts: '異常', + pausedAccounts: '停止調度', + rateLimitedAccounts: '限流', + todayRequests: '今日請求', + totalRequests: '總請求', + systemStatus: '系統狀態', + uptime: '運行時間', + + // Platform accounts tooltip + claudeAccount: 'Claude: {total} 個 (正常: {normal})', + consoleAccount: 'Console: {total} 個 (正常: {normal})', + geminiAccount: 'Gemini: {total} 個 (正常: {normal})', + bedrockAccount: 'Bedrock: {total} 個 (正常: {normal})', + openaiAccount: 'OpenAI: {total} 個 (正常: {normal})', + azureOpenaiAccount: 'Azure OpenAI: {total} 個 (正常: {normal})', + + // Token stats cards + todayToken: '今日Token', + totalTokenConsumption: '總Token消耗', + inputTokens: '輸入', + outputTokens: '輸出', + cacheCreateTokens: '快取建立', + cacheReadTokens: '快取讀取', + + // Real-time metrics + realtimeRPM: '即時RPM', + realtimeTPM: '即時TPM', + requestsPerMinute: '每分钟請求數', + tokensPerMinute: '每分钟Token數', + historicalData: '歷史資料', + minutes: '分钟', + + // Charts section + modelDistributionAndTrend: '模型使用分佈與Token使用趋勢', + + // Date filter presets + today: '今日', + yesterday: '昨日', + last7Days: '近 7 天', + last30Days: '近 30 天', + thisWeek: '本週', + lastWeek: '上週', + thisMonth: '本月', + lastMonth: '上月', + + // Granularity buttons + byDay: '按日', + byHour: '按小時', + + // Date picker + startDatePlaceholder: '開始日期', + endDatePlaceholder: '結束日期', + dateSeparator: '至', + maxHours24: '最多24小時', + + // Auto refresh controls + autoRefresh: '自動刷新', + refresh: '刷新', + refreshing: '刷新中', + refreshDataNow: '立即刷新資料', + + // Charts + tokenUsageDistribution: 'Token使用分佈', + detailedStatistics: '詳細統計資料', + noModelUsageData: '暫無模型使用資料', + + // Table headers + model: '模型', + requestCount: '請求數', + totalTokens: '總Token', + cost: '費用', + percentage: '占比', + + // Trend charts + tokenUsageTrend: 'Token使用趋勢', + apiKeysUsageTrend: 'API Keys 使用趋勢', + requestsCount: '請求次數', + tokenCount: 'Token 數量', + totalApiKeysCount: '共 {count} 個 API Key', + showingTop10: '共 {count} 個 API Key,顯示使用量前 10 個', + + // Chart labels + inputTokensLabel: '輸入Token', + outputTokensLabel: '輸出Token', + cacheCreateTokensLabel: '快取建立Token', + cacheReadTokensLabel: '快取讀取Token', + costLabel: '費用 (USD)', + requestsLabel: '請求數', + time: '時間', + date: '日期', + tokenQuantity: 'Token數量', + requestsQuantity: '請求次數' } } diff --git a/web/admin-spa/src/views/DashboardView.vue b/web/admin-spa/src/views/DashboardView.vue index 17b7d361..f668fd20 100644 --- a/web/admin-spa/src/views/DashboardView.vue +++ b/web/admin-spa/src/views/DashboardView.vue @@ -8,13 +8,13 @@

- 总API Keys + {{ t('dashboard.totalApiKeys') }}

{{ dashboardData.totalApiKeys }}

- 活跃: {{ dashboardData.activeApiKeys || 0 }} + {{ t('dashboard.activeApiKeys') }}: {{ dashboardData.activeApiKeys || 0 }}

@@ -27,7 +27,7 @@

- 服务账户 + {{ t('dashboard.serviceAccounts') }}

@@ -42,7 +42,7 @@ dashboardData.accountsByPlatform.claude.total > 0 " class="inline-flex items-center gap-0.5" - :title="`Claude: ${dashboardData.accountsByPlatform.claude.total} 个 (正常: ${dashboardData.accountsByPlatform.claude.normal})`" + :title="t('dashboard.claudeAccount', { total: dashboardData.accountsByPlatform.claude.total, normal: dashboardData.accountsByPlatform.claude.normal })" > {{ @@ -56,7 +56,7 @@ dashboardData.accountsByPlatform['claude-console'].total > 0 " class="inline-flex items-center gap-0.5" - :title="`Console: ${dashboardData.accountsByPlatform['claude-console'].total} 个 (正常: ${dashboardData.accountsByPlatform['claude-console'].normal})`" + :title="t('dashboard.consoleAccount', { total: dashboardData.accountsByPlatform['claude-console'].total, normal: dashboardData.accountsByPlatform['claude-console'].normal })" > {{ @@ -70,7 +70,7 @@ dashboardData.accountsByPlatform.gemini.total > 0 " class="inline-flex items-center gap-0.5" - :title="`Gemini: ${dashboardData.accountsByPlatform.gemini.total} 个 (正常: ${dashboardData.accountsByPlatform.gemini.normal})`" + :title="t('dashboard.geminiAccount', { total: dashboardData.accountsByPlatform.gemini.total, normal: dashboardData.accountsByPlatform.gemini.normal })" > {{ @@ -84,7 +84,7 @@ dashboardData.accountsByPlatform.bedrock.total > 0 " class="inline-flex items-center gap-0.5" - :title="`Bedrock: ${dashboardData.accountsByPlatform.bedrock.total} 个 (正常: ${dashboardData.accountsByPlatform.bedrock.normal})`" + :title="t('dashboard.bedrockAccount', { total: dashboardData.accountsByPlatform.bedrock.total, normal: dashboardData.accountsByPlatform.bedrock.normal })" > {{ @@ -98,7 +98,7 @@ dashboardData.accountsByPlatform.openai.total > 0 " class="inline-flex items-center gap-0.5" - :title="`OpenAI: ${dashboardData.accountsByPlatform.openai.total} 个 (正常: ${dashboardData.accountsByPlatform.openai.normal})`" + :title="t('dashboard.openaiAccount', { total: dashboardData.accountsByPlatform.openai.total, normal: dashboardData.accountsByPlatform.openai.normal })" > {{ @@ -112,7 +112,7 @@ dashboardData.accountsByPlatform.azure_openai.total > 0 " class="inline-flex items-center gap-0.5" - :title="`Azure OpenAI: ${dashboardData.accountsByPlatform.azure_openai.total} 个 (正常: ${dashboardData.accountsByPlatform.azure_openai.normal})`" + :title="t('dashboard.azureOpenaiAccount', { total: dashboardData.accountsByPlatform.azure_openai.total, normal: dashboardData.accountsByPlatform.azure_openai.normal })" > {{ @@ -122,18 +122,18 @@

- 正常: {{ dashboardData.normalAccounts || 0 }} + {{ t('dashboard.normalAccounts') }}: {{ dashboardData.normalAccounts || 0 }} - | 异常: {{ dashboardData.abnormalAccounts }} + | {{ t('dashboard.abnormalAccounts') }}: {{ dashboardData.abnormalAccounts }} - | 停止调度: {{ dashboardData.pausedAccounts }} + | {{ t('dashboard.pausedAccounts') }}: {{ dashboardData.pausedAccounts }} - | 限流: {{ dashboardData.rateLimitedAccounts }} + | {{ t('dashboard.rateLimitedAccounts') }}: {{ dashboardData.rateLimitedAccounts }}

@@ -147,13 +147,13 @@

- 今日请求 + {{ t('dashboard.todayRequests') }}

{{ dashboardData.todayRequests }}

- 总请求: {{ formatNumber(dashboardData.totalRequests || 0) }} + {{ t('dashboard.totalRequests') }}: {{ formatNumber(dashboardData.totalRequests || 0) }}

@@ -166,13 +166,13 @@

- 系统状态 + {{ t('dashboard.systemStatus') }}

{{ dashboardData.systemStatus }}

- 运行时间: {{ formattedUptime }} + {{ t('dashboard.uptime') }}: {{ formattedUptime }}

@@ -190,7 +190,7 @@

- 今日Token + {{ t('dashboard.todayToken') }}

@@ -210,25 +210,25 @@

输入: + >{{ t('dashboard.inputTokens') }}: {{ formatNumber(dashboardData.todayInputTokens || 0) }} 输出: + >{{ t('dashboard.outputTokens') }}: {{ formatNumber(dashboardData.todayOutputTokens || 0) }} 缓存创建: + >{{ t('dashboard.cacheCreateTokens') }}: {{ formatNumber(dashboardData.todayCacheCreateTokens || 0) }} 缓存读取: + >{{ t('dashboard.cacheReadTokens') }}: {{ formatNumber(dashboardData.todayCacheReadTokens || 0) }}

- 总Token消耗 + {{ t('dashboard.totalTokenConsumption') }}

@@ -266,13 +266,13 @@

输入: + >{{ t('dashboard.inputTokens') }}: {{ formatNumber(dashboardData.totalInputTokens || 0) }} 输出: + >{{ t('dashboard.outputTokens') }}: {{ formatNumber(dashboardData.totalOutputTokens || 0) }}

- 实时RPM - ({{ dashboardData.metricsWindow }}分钟) + {{ t('dashboard.realtimeRPM') }} + ({{ dashboardData.metricsWindow }}{{ t('dashboard.minutes') }})

{{ dashboardData.realtimeRPM || 0 }}

- 每分钟请求数 + {{ t('dashboard.requestsPerMinute') }} - 历史数据 + {{ t('dashboard.historicalData') }}

@@ -325,16 +325,16 @@

- 实时TPM - ({{ dashboardData.metricsWindow }}分钟) + {{ t('dashboard.realtimeTPM') }} + ({{ dashboardData.metricsWindow }}{{ t('dashboard.minutes') }})

{{ formatNumber(dashboardData.realtimeTPM || 0) }}

- 每分钟Token数 + {{ t('dashboard.tokensPerMinute') }} - 历史数据 + {{ t('dashboard.historicalData') }}

@@ -349,7 +349,7 @@

- 模型使用分布与Token使用趋势 + {{ t('dashboard.modelDistributionAndTrend') }}

@@ -382,7 +382,7 @@ ]" @click="setTrendGranularity('day')" > - 按天 + {{ t('dashboard.byDay') }}
@@ -404,18 +404,18 @@ class="custom-date-picker w-full lg:w-auto" :default-time="defaultTime" :disabled-date="disabledDate" - end-placeholder="结束日期" + :end-placeholder="t('dashboard.endDatePlaceholder')" format="YYYY-MM-DD HH:mm:ss" - range-separator="至" + :range-separator="t('dashboard.dateSeparator')" size="default" - start-placeholder="开始日期" + :start-placeholder="t('dashboard.startDatePlaceholder')" style="max-width: 400px" type="datetimerange" value-format="YYYY-MM-DD HH:mm:ss" @change="onCustomDateRangeChange" /> - 最多24小时 + {{ t('dashboard.maxHours24') }}
@@ -433,7 +433,7 @@ class="ml-2.5 flex select-none items-center gap-1 text-sm font-medium text-gray-600 dark:text-gray-300" > - 自动刷新 + {{ t('dashboard.autoRefresh') }} - +
@@ -463,7 +463,7 @@

- Token使用分布 + {{ t('dashboard.tokenUsageDistribution') }}

@@ -473,10 +473,10 @@

- 详细统计数据 + {{ t('dashboard.detailedStatistics') }}

-

暂无模型使用数据

+

{{ t('dashboard.noModelUsageData') }}

@@ -485,27 +485,27 @@ @@ -566,7 +566,7 @@

- API Keys 使用趋势 + {{ t('dashboard.apiKeysUsageTrend') }}

@@ -579,8 +579,8 @@ ]" @click="((apiKeysTrendMetric = 'requests'), updateApiKeysUsageTrendChart())" > - 请求 + {{ t('dashboard.requestsCount').split(' ')[0] }}
- 共 {{ apiKeysTrendData.totalApiKeys }} 个 API Key,显示使用量前 10 个 + {{ t('dashboard.showingTop10', { count: apiKeysTrendData.totalApiKeys }) }} - 共 {{ apiKeysTrendData.totalApiKeys }} 个 API Key + {{ t('dashboard.totalApiKeysCount', { count: apiKeysTrendData.totalApiKeys }) }}
@@ -613,12 +613,14 @@
- 模型 + {{ t('dashboard.model') }} - 总Token + {{ t('dashboard.totalTokens') }} - 费用 + {{ t('dashboard.cost') }}