diff --git a/packages/cli/src/i18n/locales/en.js b/packages/cli/src/i18n/locales/en.js index b1accff5..41026026 100644 --- a/packages/cli/src/i18n/locales/en.js +++ b/packages/cli/src/i18n/locales/en.js @@ -879,6 +879,36 @@ export default { 'of input tokens were served from the cache, reducing costs.', 'Tip: For a full token breakdown, run `/stats model`.': 'Tip: For a full token breakdown, run `/stats model`.', + 'Model Stats For Nerds': 'Model Stats For Nerds', + 'Tool Stats For Nerds': 'Tool Stats For Nerds', + Metric: 'Metric', + API: 'API', + Requests: 'Requests', + Errors: 'Errors', + 'Avg Latency': 'Avg Latency', + Tokens: 'Tokens', + Total: 'Total', + Prompt: 'Prompt', + Cached: 'Cached', + Thoughts: 'Thoughts', + Tool: 'Tool', + Output: 'Output', + 'No API calls have been made in this session.': + 'No API calls have been made in this session.', + 'Tool Name': 'Tool Name', + Calls: 'Calls', + 'Success Rate': 'Success Rate', + 'Avg Duration': 'Avg Duration', + 'User Decision Summary': 'User Decision Summary', + 'Total Reviewed Suggestions:': 'Total Reviewed Suggestions:', + ' » Accepted:': ' » Accepted:', + ' » Rejected:': ' » Rejected:', + ' » Modified:': ' » Modified:', + ' Overall Agreement Rate:': ' Overall Agreement Rate:', + 'No tool calls have been made in this session.': + 'No tool calls have been made in this session.', + 'Session start time is unavailable, cannot calculate stats.': + 'Session start time is unavailable, cannot calculate stats.', // ============================================================================ // Loading Phrases diff --git a/packages/cli/src/i18n/locales/zh.js b/packages/cli/src/i18n/locales/zh.js index b34a7d49..1421ab7c 100644 --- a/packages/cli/src/i18n/locales/zh.js +++ b/packages/cli/src/i18n/locales/zh.js @@ -832,6 +832,36 @@ export default { '的输入令牌来自缓存,降低了成本', 'Tip: For a full token breakdown, run `/stats model`.': '提示:要查看完整的令牌明细,请运行 `/stats model`', + 'Model Stats For Nerds': '模型统计(技术细节)', + 'Tool Stats For Nerds': '工具统计(技术细节)', + Metric: '指标', + API: 'API', + Requests: '请求数', + Errors: '错误数', + 'Avg Latency': '平均延迟', + Tokens: '令牌', + Total: '总计', + Prompt: '提示', + Cached: '缓存', + Thoughts: '思考', + Tool: '工具', + Output: '输出', + 'No API calls have been made in this session.': + '本次会话中未进行任何 API 调用', + 'Tool Name': '工具名称', + Calls: '调用次数', + 'Success Rate': '成功率', + 'Avg Duration': '平均耗时', + 'User Decision Summary': '用户决策摘要', + 'Total Reviewed Suggestions:': '已审核建议总数:', + ' » Accepted:': ' » 已接受:', + ' » Rejected:': ' » 已拒绝:', + ' » Modified:': ' » 已修改:', + ' Overall Agreement Rate:': ' 总体同意率:', + 'No tool calls have been made in this session.': + '本次会话中未进行任何工具调用', + 'Session start time is unavailable, cannot calculate stats.': + '会话开始时间不可用,无法计算统计信息', // ============================================================================ // Loading Phrases diff --git a/packages/cli/src/ui/commands/statsCommand.ts b/packages/cli/src/ui/commands/statsCommand.ts index 5248ca43..cb4a3f51 100644 --- a/packages/cli/src/ui/commands/statsCommand.ts +++ b/packages/cli/src/ui/commands/statsCommand.ts @@ -28,7 +28,7 @@ export const statsCommand: SlashCommand = { context.ui.addItem( { type: MessageType.ERROR, - text: 'Session start time is unavailable, cannot calculate stats.', + text: t('Session start time is unavailable, cannot calculate stats.'), }, Date.now(), ); diff --git a/packages/cli/src/ui/components/ModelStatsDisplay.tsx b/packages/cli/src/ui/components/ModelStatsDisplay.tsx index 95a8fe46..ce0a481e 100644 --- a/packages/cli/src/ui/components/ModelStatsDisplay.tsx +++ b/packages/cli/src/ui/components/ModelStatsDisplay.tsx @@ -15,6 +15,7 @@ import { } from '../utils/computeStats.js'; import type { ModelMetrics } from '../contexts/SessionContext.js'; import { useSessionStats } from '../contexts/SessionContext.js'; +import { t } from '../../i18n/index.js'; const METRIC_COL_WIDTH = 28; const MODEL_COL_WIDTH = 22; @@ -65,7 +66,7 @@ export const ModelStatsDisplay: React.FC = () => { paddingX={2} > - No API calls have been made in this session. + {t('No API calls have been made in this session.')} ); @@ -94,7 +95,7 @@ export const ModelStatsDisplay: React.FC = () => { paddingX={2} > - Model Stats For Nerds + {t('Model Stats For Nerds')} @@ -102,7 +103,7 @@ export const ModelStatsDisplay: React.FC = () => { - Metric + {t('Metric')} {modelNames.map((name) => ( @@ -125,13 +126,13 @@ export const ModelStatsDisplay: React.FC = () => { /> {/* API Section */} - + m.api.totalRequests.toLocaleString())} /> { const errorRate = calculateErrorRate(m); return ( @@ -146,7 +147,7 @@ export const ModelStatsDisplay: React.FC = () => { })} /> { const avgLatency = calculateAverageLatency(m); return formatDuration(avgLatency); @@ -156,9 +157,9 @@ export const ModelStatsDisplay: React.FC = () => { {/* Tokens Section */} - + ( {m.tokens.total.toLocaleString()} @@ -166,13 +167,13 @@ export const ModelStatsDisplay: React.FC = () => { ))} /> m.tokens.prompt.toLocaleString())} /> {hasCached && ( { const cacheHitRate = calculateCacheHitRate(m); @@ -186,20 +187,20 @@ export const ModelStatsDisplay: React.FC = () => { )} {hasThoughts && ( m.tokens.thoughts.toLocaleString())} /> )} {hasTool && ( m.tokens.tool.toLocaleString())} /> )} m.tokens.candidates.toLocaleString())} /> diff --git a/packages/cli/src/ui/components/ToolStatsDisplay.tsx b/packages/cli/src/ui/components/ToolStatsDisplay.tsx index e1dcb959..f45dd9e8 100644 --- a/packages/cli/src/ui/components/ToolStatsDisplay.tsx +++ b/packages/cli/src/ui/components/ToolStatsDisplay.tsx @@ -17,6 +17,7 @@ import { } from '../utils/displayUtils.js'; import { useSessionStats } from '../contexts/SessionContext.js'; import type { ToolCallStats } from '@qwen-code/qwen-code-core'; +import { t } from '../../i18n/index.js'; const TOOL_NAME_COL_WIDTH = 25; const CALLS_COL_WIDTH = 8; @@ -68,7 +69,7 @@ export const ToolStatsDisplay: React.FC = () => { paddingX={2} > - No tool calls have been made in this session. + {t('No tool calls have been made in this session.')} ); @@ -103,7 +104,7 @@ export const ToolStatsDisplay: React.FC = () => { width={70} > - Tool Stats For Nerds + {t('Tool Stats For Nerds')} @@ -111,22 +112,22 @@ export const ToolStatsDisplay: React.FC = () => { - Tool Name + {t('Tool Name')} - Calls + {t('Calls')} - Success Rate + {t('Success Rate')} - Avg Duration + {t('Avg Duration')} @@ -151,13 +152,15 @@ export const ToolStatsDisplay: React.FC = () => { {/* User Decision Summary */} - User Decision Summary + {t('User Decision Summary')} - Total Reviewed Suggestions: + + {t('Total Reviewed Suggestions:')} + {totalReviewed} @@ -167,7 +170,7 @@ export const ToolStatsDisplay: React.FC = () => { - » Accepted: + {t(' » Accepted:')} {totalDecisions.accept} @@ -177,7 +180,7 @@ export const ToolStatsDisplay: React.FC = () => { - » Rejected: + {t(' » Rejected:')} {totalDecisions.reject} @@ -187,7 +190,7 @@ export const ToolStatsDisplay: React.FC = () => { - » Modified: + {t(' » Modified:')} {totalDecisions.modify} @@ -209,7 +212,9 @@ export const ToolStatsDisplay: React.FC = () => { - Overall Agreement Rate: + + {t(' Overall Agreement Rate:')} + 0 ? agreementColor : undefined}>