feat(logs): 实时日志改为读库,重启不丢

- 新增 GET /logs/recent?n=200(从 api_calls 取最近 N 条,形状与 /logs 条目一致)
- 权限口径不变:只看自己的(admin 也只看自己);看全站走 /logs/calls
- 前端实时页改调 /logs/recent,保留 5 秒自动刷新
- 修 query() 漏选 tok_* 四列导致实时页 token 显示为 0
- 版本 2.9.5 → 2.9.6
This commit is contained in:
jidekin committed 2026-10-23 15:28:09 +08:00
1 parent 36db428b90
commit 4799c6d3f5
4 files changed
+68 -3

No files matched your search

+2 -1
View File
@@ -201,7 +201,8 @@ async function load() {
await api(`/v1/videos/${encodeURIComponent(e.video_id)}?model=${encodeURIComponent(e.served || e.model || '')}`)
} catch { /* 轮询失败不打断刷新;后端会记为该次的失败快照 */ }
}
const j = await api('/logs?n=200')
// 2026-10-23:改读库(/logs/recent)—— 内存环缓冲重启即丢,库里才是持久的
const j = await api('/logs/recent?n=200')
entries.value = j.entries || []
// 只保留仍存在的已展开行:行被顶出窗口/被删则对应 key 一并清掉
const alive = new Set(entries.value.map(rowKey))