feat(web): 用量明细展示缓存读/写与上游实际模型,补 1h 缓存写与思考口径
API:/api/v1/usage/logs 与 /api/v1/admin/usage 返回 cache_creation_tokens、 reasoning_tokens、cache_write_1h_tokens、served_model(types.ts 同步可选字段)。 前端: - 模型列在被模型映射/聚合商改写时显示「→ 上游实际模型」,长名截断并可悬浮看全; - 表格里 Token 列第二行显示缓存读/写(与成本直接相关),1h 缓存写与思考 token 放悬浮提示——两者直接上表格会把 Token 列撑到 255px,1280 宽下把「时间/原始」 挤出视野(实测 1146px vs 容器 1006px);移动卡两行都显示; - 用量表协议列由 chat/completions 简化为 chat(表头已标明「API 格式」), 时间列改月-日 时:分、完整时间进 title;调整后桌面端表格宽度 1006px, 与容器一致、无横向滚动; - 顺带修复控制台用量页 Button 未导入(上一页/下一页此前渲染不出来)。 验证:本地 mock 上游 + 临时 sqlite 实例与真实数据实测;1280 桌面与 390 窄屏 截图核对(表格 tableW == 容器宽度);vue-tsc、vitest、eslint、vite build 与 go vet、go test ./... 全绿。
This commit is contained in:
1 parent
04dfb4285d
commit
d34d9bd2e6
5 files changed
+135
-18
No files matched your search
@@ -257,7 +257,9 @@ func (h *Handler) AdminUsage(c *gin.Context) {
|
||||
"id": l.ID, "user": userNames[l.UserID], "user_id": l.UserID, "model": l.ModelName, "protocol": l.Protocol,
|
||||
"channel_id": l.ChannelID, "channel": chNames[l.ChannelID],
|
||||
"input_tokens": l.InputTokens, "output_tokens": l.OutputTokens,
|
||||
"cache_read_tokens": l.CacheReadTokens, "cost": l.Cost,
|
||||
"cache_read_tokens": l.CacheReadTokens, "cache_creation_tokens": l.CacheCreationTokens,
|
||||
"reasoning_tokens": l.ReasoningTokens, "cache_write_1h_tokens": l.CacheWrite1hTokens,
|
||||
"served_model": l.ServedModel, "cost": l.Cost,
|
||||
"latency_ms": l.LatencyMS, "status": l.Status, "error_code": l.ErrorCode,
|
||||
"raw_request": l.RawRequest, "raw_response": l.RawResponse,
|
||||
"created_at": l.CreatedAt,
|
||||
|
||||
Reference in new issue
Block a user