From 49e69bf5adfeaab62f5d450ba81511ddf3afa0e5 Mon Sep 17 00:00:00 2001 From: jidekin <294297426@qq.com> Date: Fri, 23 Oct 2026 15:37:02 +0800 Subject: [PATCH] =?UTF-8?q?feat(logs):=20=E8=B0=83=E7=94=A8=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E5=88=97=E8=A1=A8=E5=8A=A0=E3=80=8C=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E5=91=BD=E4=B8=AD=E3=80=8D=E5=88=97=EF=BC=88=E9=87=8F=20+=20?= =?UTF-8?q?=E5=91=BD=E4=B8=AD=E7=8E=87=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 数据本来就有(tok_cached/tok_prompt),只是列表没显示:命中率此前只在详情弹窗里。 - 列表新增列:命中量(k/M 缩写)+ 命中率%(按档位配色) - 实测 107 条带 token 记录:命中 62 条,中位 83.9%,最高 99.7% - 版本 2.9.8 → 2.9.9 --- CHANGELOG.md | 18 ++++++++++++++++++ app/main.py | 2 +- frontend/src/locales/en.ts | 1 + frontend/src/locales/zh.ts | 1 + frontend/src/views/CallLogs.vue | 32 ++++++++++++++++++++++++++++++++ 5 files changed, 53 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2afcda..f626fb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # CHANGELOG +## 2026-10-23 · 调用日志列表加「缓存命中」列(2.9.8 → 2.9.9) + +老板:「调用日志的命中缓存率为什么一直都是 0」。 + +**先给结论:数据没坏,是列表上看不到这一列。** 缓存命中率一直只在**详情弹窗**里显示, +列表没有;而 admin 自己那几条测试请求都是 38~41 token 的短提示词,上游不会缓存 → +所以看起来"一直是 0"。真实业务的调用是命中的。 + +实测(同一时刻库里的 107 条带 token 记录): +- **命中 62 条 / 未命中 45 条** +- 命中组:最低 11.1%、**中位 83.9%**、最高 99.7% +- 未命中组:输入 38 ~ 60192 token(短提示词不触发上游缓存;长提示词的前缀不一致也不命中) + +改动: +- 调用日志列表新增「缓存命中」列(在耗时之后):显示 `命中量 / 命中率%`, + 量按 k/M 缩写,命中率按档位配色(≥50% 绿、>0 黄、0 淡显)。 +- 数据直接取列表接口已返回的 `tok_cached` / `tok_prompt`,无额外查询。 + ## 2026-10-23 · 视频轮询时间线落库(2.9.7 → 2.9.8) 老板:「视频任务的轮询时间线也要落库」。 diff --git a/app/main.py b/app/main.py index 3043a46..fe62cd0 100644 --- a/app/main.py +++ b/app/main.py @@ -355,7 +355,7 @@ _docs_on = config.server.docs_enabled # 安全默认关(report: /docs、/ope # 2026-09-30: 2.6.1 → 2.7.0(按老板要求整个删除「火山方舟 Coding Plan」供应商:配置/模型/代码/文档/前端下拉/环境变量全清)。 # 2026-09-30: 2.7.0 → 2.7.1(界面提示白话化:熔断器→供应商自动保护、引擎→运行环境、slug→标识;删 120 个未引用死键)。 # ★ 版本号纪律:每次改动都要往上加,小改动加小版本号、大改动加大版本号(README 有专章)。 -VERSION = "2.9.8" +VERSION = "2.9.9" app = FastAPI( title="API Gateway", diff --git a/frontend/src/locales/en.ts b/frontend/src/locales/en.ts index 9dc7ed9..8fc044d 100644 --- a/frontend/src/locales/en.ts +++ b/frontend/src/locales/en.ts @@ -244,6 +244,7 @@ export default { colFailRate: 'Fail rate', colModels: 'Models', colContent: 'Content', + colCache: 'Cache hit', }, users: { diff --git a/frontend/src/locales/zh.ts b/frontend/src/locales/zh.ts index ce3d864..4309756 100644 --- a/frontend/src/locales/zh.ts +++ b/frontend/src/locales/zh.ts @@ -244,6 +244,7 @@ export default { colFailRate: '失败率', colModels: '模型数', colContent: '内容', + colCache: '缓存命中', }, users: { diff --git a/frontend/src/views/CallLogs.vue b/frontend/src/views/CallLogs.vue index bad23d6..867fee3 100644 --- a/frontend/src/views/CallLogs.vue +++ b/frontend/src/views/CallLogs.vue @@ -62,6 +62,16 @@ + + + +