feat(calllog): 调用日志落地(SQLite / 90 天 / 管理员可查全部)

- app/calllog.py:SQLite 表 api_calls(21 列,含提示词与回复)+ 异步批量写 + 双向握手
  (流式请求的访问日志条目比响应晚到也能落库)+ 早失败补记 + 失败也记 Key 前 8 位
- 新增 4 个仅管理员端点:/logs/calls、/logs/calls/stats、/logs/calls/{id}、/logs/calls/export
- 前端:日志页新增「实时 / 调用日志」页签,新组件 CallLogs.vue(筛选/分页/详情/CSV 导出)
- 保留 90 天;队列满丢弃计数,不反压请求;零新依赖
- docs:新增 docs/call-log-design.md(方案对比与三个关键设计)
- 版本 2.7.3 → 2.8.0
This commit is contained in:
jidekin committed 2026-10-23 10:02:07 +08:00
1 parent 1999b5e7ac
commit 09b79c1306
10 files changed
+1101 -4

No files matched your search

+30
View File
@@ -169,6 +169,8 @@ export default {
byProvider: 'Calls by provider (success / fail)',
},
logs: {
tabLive: 'Realtime',
tabCalls: 'Call log',
all: 'All',
chat: 'Chat',
image: 'Image',
@@ -818,5 +820,33 @@ export default {
errAudioTooBig: '{name} is {size}, over the reference-audio limit of {max} (please trim or compress it)',
errBodyBudget: 'This request body is about {size}, over the gateway upload limit (~{max}).',
errBodyBudgetTip: 'Please use fewer materials, or smaller images/audio files.',
calllogs: {
title: 'Call log (persisted)',
count: '{n} rows',
failN: '{n} failed',
avgMs: 'avg {n}ms',
startDate: 'Start',
endDate: 'End',
account: 'Account',
model: 'Model',
result: 'Result',
onlyOk: 'OK only',
onlyFail: 'Failed only',
keyword: 'Keyword (content/rid/IP/UA)',
colTime: 'Time',
colAccount: 'Account',
colModel: 'Model',
colLatency: 'Latency',
colStatus: 'Status',
colStream: 'Stream',
colUa: 'UA',
yes: 'yes',
no: 'no',
detailTitle: 'Call detail',
prompt: 'Prompt (request body, truncated)',
completion: 'Completion (truncated)',
loading: 'Loading…',
},
},
}