diff --git a/messages/en.json b/messages/en.json index c2a38ff..f0b41e2 100644 --- a/messages/en.json +++ b/messages/en.json @@ -406,6 +406,7 @@ "statistics": "Statistics", "inputTokens": "Input Tokens", "outputTokens": "Output Tokens", + "totalTokens": "Total Tokens", "totalCost": "Total Cost", "duration": "Duration", "copiedToClipboard": "Copied to clipboard", diff --git a/messages/zh.json b/messages/zh.json index b435ecd..2edfc45 100644 --- a/messages/zh.json +++ b/messages/zh.json @@ -406,6 +406,7 @@ "statistics": "统计信息", "inputTokens": "输入Token", "outputTokens": "输出Token", + "totalTokens": "总Token数", "totalCost": "总费用", "duration": "持续时间", "copiedToClipboard": "已复制到剪贴板", diff --git a/src/app/simulator/page.tsx b/src/app/simulator/page.tsx index e77f139..72109dc 100644 --- a/src/app/simulator/page.tsx +++ b/src/app/simulator/page.tsx @@ -21,7 +21,8 @@ import { RefreshCw, Zap, DollarSign, - Copy + Copy, + BarChart3 } from 'lucide-react' import Link from 'next/link' import { formatDistanceToNow } from 'date-fns' @@ -164,7 +165,14 @@ export default function SimulatorPage() { const completed = runs.filter(run => run.status === 'completed').length const running = runs.filter(run => run.status === 'running').length const failed = runs.filter(run => run.status === 'failed').length - return { total, completed, running, failed } + + // Calculate total tokens and cost + const totalInputTokens = runs.reduce((sum, run) => sum + (run.inputTokens || 0), 0) + const totalOutputTokens = runs.reduce((sum, run) => sum + (run.outputTokens || 0), 0) + const totalTokens = totalInputTokens + totalOutputTokens + const totalCost = runs.reduce((sum, run) => sum + (run.totalCost || 0), 0) + + return { total, completed, running, failed, totalTokens, totalCost } } if (authLoading) { @@ -208,13 +216,13 @@ export default function SimulatorPage() { {/* Stats */} {runs.length > 0 && ( -