feat(usage): 新增输出速度统计与请求详情性能分析

- 把 upstream_is_stream 物化到 usage 与 billing facts,避免 Provider 聚合回连 public.usage
- 统一前端标准/流式 TPS 计算与显示,流式按首字后生成耗时计算
- 新增请求详情抽屉展示单请求输出速度与 Provider 聚合 TPS
This commit is contained in:
mayrain
2026-05-05 17:34:12 +08:00
parent f0197b685f
commit 6b6d32b4a3
14 changed files with 712 additions and 64 deletions

View File

@@ -594,7 +594,7 @@
{{ formatProviderPerformanceMetric(provider.success_rate, '%') }}
</td>
<td class="px-3 py-2 text-right">
{{ formatProviderPerformanceMetric(provider.avg_output_tps, '/s') }}
{{ formatProviderPerformanceMetric(provider.avg_output_tps, ' tps') }}
</td>
<td class="px-3 py-2 text-right">
{{ formatProviderPerformanceMetric(provider.avg_first_byte_time_ms, 'ms') }}
@@ -1093,7 +1093,7 @@ const providerPerformanceSummaryCards = computed(() => {
return [
{
title: '输出 TPS',
value: formatProviderPerformanceMetric(summary?.avg_output_tps, '/s'),
value: formatProviderPerformanceMetric(summary?.avg_output_tps, ' tps'),
hint: `请求 ${formatMetricNumber(summary?.request_count)}`,
icon: Zap,
iconClass: 'text-amber-500',
@@ -1142,7 +1142,7 @@ const providerTpsChartOptions = computed(() => ({
scales: {
y: {
ticks: {
callback: (value: string | number) => `${value}/s`,
callback: (value: string | number) => `${value} tps`,
},
},
},