Add token usage stats and consolidate credentials in SQLite
build / build (push) Successful in 2m34s

- New internal/stats (types) and internal/store (SQLite owner: requests + credentials tables, WAL); store implements stats.Recorder.
- Stream (SSE tee) and non-stream chat paths parse upstream usage incl. cached_tokens and record per-request; add /api/stats, /api/stats/reset, /admin/stats HTML with cache hit rate.
- Drop credentials.json: remove auth file I/O and ZHANLU_CREDENTIALS_FILE; credential precedence is env vars > db row.
This commit is contained in:
2026-08-19 15:52:00 +08:00
parent dd5c560b64
commit fa9640d919
15 changed files with 1101 additions and 103 deletions
+6 -1
View File
@@ -1,4 +1,9 @@
credentials.json
zhanlu.db
zhanlu.db-shm
zhanlu.db-wal
*.db
*.db-shm
*.db-wal
extension/
*.exe
*.log