Compare commits

...

2 Commits

Author SHA1 Message Date
Soulter
a88e0adc63 fix(stats): range 2026-04-27 10:37:58 +08:00
Soulter
260d38a83b fix(stats): TPM now only counts output tokens
- Add range_total_output_tokens accumulation, separate from total tokens
- Change range_avg_tpm formula to use output tokens only
- Update i18n labels to reflect Output TPM
2026-04-27 10:27:50 +08:00
4 changed files with 7 additions and 4 deletions

View File

@@ -243,6 +243,7 @@ class StatRoute(Route):
total_by_umo: dict[str, int] = defaultdict(int)
total_by_bucket: dict[int, int] = defaultdict(int)
range_total_tokens = 0
range_total_output_tokens = 0
range_total_calls = 0
range_success_calls = 0
range_ttft_total_ms = 0.0
@@ -286,6 +287,7 @@ class StatRoute(Route):
record.end_time - record.start_time
) * 1000
range_duration_samples += 1
range_total_output_tokens += record.token_output
if created_at_local >= today_start_local:
today_total_calls += 1
@@ -371,7 +373,8 @@ class StatRoute(Route):
else 0
),
"range_avg_tpm": (
range_total_tokens / (range_duration_total_ms / 1000 / 60)
range_total_output_tokens
/ (range_duration_total_ms / 1000 / 60)
if range_duration_total_ms > 0
else 0
),

View File

@@ -67,7 +67,7 @@
"callCount": "{count} calls",
"avgTtft": "Average TTFT",
"avgDuration": "Average Response Time",
"avgTpm": "Average TPM",
"avgTpm": "Average Output TPM",
"successRate": "Success Rate"
},
"modelRanking": {

View File

@@ -67,7 +67,7 @@
"callCount": "{count} вызовов",
"avgTtft": "Средний TTFT",
"avgDuration": "Среднее время ответа",
"avgTpm": "Средний TPM",
"avgTpm": "Средний Output TPM",
"successRate": "Доля успешных вызовов"
},
"modelRanking": {

View File

@@ -67,7 +67,7 @@
"callCount": "共 {count} 次调用",
"avgTtft": "平均首字延迟TTFT",
"avgDuration": "平均响应时间",
"avgTpm": "平均每分钟词元数TPM",
"avgTpm": "平均每分钟输出TPM",
"successRate": "调用成功率"
},
"modelRanking": {