mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-07 18:07:47 +08:00
feat(usage): 统计表格新增输入/输出与缓存创建token细分展示
- 后端接口(admin/user_me/query)新增 output_tokens、cache_creation_tokens、total_input_context 字段返回 - 前端统计表格(模型/提供商/API格式)合并 Tokens 列为"输入/输出"+"缓存读取/创建"两行紧凑布局 - 合并"缓存Token"和"缓存命中率"为单一"命中率"列,减少表格宽度 - 修正 UsageRecordsTable 缩进及模板格式
This commit is contained in:
@@ -110,7 +110,10 @@ export function useUsageData(options: UseUsageDataOptions) {
|
||||
model: item.model,
|
||||
request_count: item.request_count || 0,
|
||||
total_tokens: item.total_tokens || 0,
|
||||
total_input_context: typeof raw.total_input_context === 'number' ? raw.total_input_context : 0,
|
||||
output_tokens: typeof raw.output_tokens === 'number' ? raw.output_tokens : 0,
|
||||
cache_read_tokens: typeof raw.cache_read_tokens === 'number' ? raw.cache_read_tokens : 0,
|
||||
cache_creation_tokens: typeof raw.cache_creation_tokens === 'number' ? raw.cache_creation_tokens : 0,
|
||||
cache_hit_rate: typeof raw.cache_hit_rate === 'number' ? raw.cache_hit_rate : 0,
|
||||
total_cost: item.total_cost || 0,
|
||||
actual_cost: typeof raw.actual_cost === 'number' ? raw.actual_cost : undefined
|
||||
@@ -121,7 +124,10 @@ export function useUsageData(options: UseUsageDataOptions) {
|
||||
provider: item.provider,
|
||||
requests: item.request_count,
|
||||
totalTokens: item.total_tokens || 0,
|
||||
totalInputContext: item.total_input_context || 0,
|
||||
outputTokens: item.output_tokens || 0,
|
||||
cacheReadTokens: item.cache_read_tokens || 0,
|
||||
cacheCreationTokens: item.cache_creation_tokens || 0,
|
||||
cacheHitRate: item.cache_hit_rate || 0,
|
||||
totalCost: item.total_cost,
|
||||
actualCost: item.actual_cost,
|
||||
@@ -135,7 +141,10 @@ export function useUsageData(options: UseUsageDataOptions) {
|
||||
api_format: item.api_format,
|
||||
request_count: item.request_count || 0,
|
||||
total_tokens: item.total_tokens || 0,
|
||||
total_input_context: item.total_input_context || 0,
|
||||
output_tokens: item.output_tokens || 0,
|
||||
cache_read_tokens: item.cache_read_tokens || 0,
|
||||
cache_creation_tokens: item.cache_creation_tokens || 0,
|
||||
cache_hit_rate: item.cache_hit_rate || 0,
|
||||
total_cost: item.total_cost || 0,
|
||||
actual_cost: item.actual_cost,
|
||||
@@ -169,7 +178,10 @@ export function useUsageData(options: UseUsageDataOptions) {
|
||||
model: item.model,
|
||||
request_count: item.requests || 0,
|
||||
total_tokens: item.total_tokens || 0,
|
||||
total_input_context: item.total_input_context || 0,
|
||||
output_tokens: item.output_tokens || 0,
|
||||
cache_read_tokens: item.cache_read_tokens || 0,
|
||||
cache_creation_tokens: item.cache_creation_tokens || 0,
|
||||
cache_hit_rate: item.cache_hit_rate || 0,
|
||||
total_cost: item.total_cost_usd || 0,
|
||||
actual_cost: item.actual_total_cost_usd
|
||||
@@ -179,7 +191,10 @@ export function useUsageData(options: UseUsageDataOptions) {
|
||||
provider: item.provider,
|
||||
requests: item.requests || 0,
|
||||
totalTokens: item.total_tokens || 0,
|
||||
totalInputContext: item.total_input_context || 0,
|
||||
outputTokens: item.output_tokens || 0,
|
||||
cacheReadTokens: item.cache_read_tokens || 0,
|
||||
cacheCreationTokens: item.cache_creation_tokens || 0,
|
||||
cacheHitRate: item.cache_hit_rate || 0,
|
||||
totalCost: item.total_cost_usd || 0,
|
||||
successRate: item.success_rate || 0,
|
||||
@@ -209,7 +224,10 @@ export function useUsageData(options: UseUsageDataOptions) {
|
||||
api_format: item.api_format,
|
||||
request_count: item.request_count || 0,
|
||||
total_tokens: item.total_tokens || 0,
|
||||
total_input_context: item.total_input_context || 0,
|
||||
output_tokens: item.output_tokens || 0,
|
||||
cache_read_tokens: item.cache_read_tokens || 0,
|
||||
cache_creation_tokens: item.cache_creation_tokens || 0,
|
||||
cache_hit_rate: item.cache_hit_rate || 0,
|
||||
total_cost: item.total_cost_usd || 0,
|
||||
avgResponseTime: (item.avg_response_time_ms ?? 0) > 0
|
||||
|
||||
Reference in New Issue
Block a user