mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-31 19:22:15 +08:00
feat: add session log usage tracking without proxy
Parse Claude Code JSONL session files (~/.claude/projects/) and Codex SQLite database (~/.codex/state_5.sqlite) to track API usage without requiring proxy interception. This enables usage statistics for users who don't use the proxy feature. Key changes: - Add session_usage.rs: incremental JSONL parser with message.id dedup - Add session_usage_codex.rs: import thread-level token data from Codex - Add data_source column to proxy_request_logs (proxy/session_log/codex_db) - Add session_log_sync table for tracking parse offsets - Background sync every 60s + manual sync via DataSourceBar UI - Schema migration v7→v8 - i18n support for zh/en/ja
This commit is contained in:
@@ -1018,6 +1018,21 @@
|
||||
"unknownProvider": "Unknown Provider",
|
||||
"stream": "Stream",
|
||||
"nonStream": "Non-stream",
|
||||
"source": "Source",
|
||||
"dataSources": "Data Sources",
|
||||
"dataSource": {
|
||||
"proxy": "Proxy",
|
||||
"session_log": "Session Log",
|
||||
"codex_db": "Codex DB"
|
||||
},
|
||||
"sessionSync": {
|
||||
"trigger": "Sync session logs",
|
||||
"import": "Import Sessions",
|
||||
"resync": "Sync",
|
||||
"imported": "Imported {{count}} records from session logs",
|
||||
"upToDate": "Session logs are up to date",
|
||||
"failed": "Session sync failed"
|
||||
},
|
||||
"totalRecords": "{{total}} records total",
|
||||
"modelPricing": "Model Pricing",
|
||||
"loadPricingError": "Failed to load pricing data",
|
||||
|
||||
@@ -1018,6 +1018,21 @@
|
||||
"unknownProvider": "不明なプロバイダー",
|
||||
"stream": "ストリーム",
|
||||
"nonStream": "非ストリーム",
|
||||
"source": "ソース",
|
||||
"dataSources": "データソース",
|
||||
"dataSource": {
|
||||
"proxy": "プロキシ",
|
||||
"session_log": "セッションログ",
|
||||
"codex_db": "Codex DB"
|
||||
},
|
||||
"sessionSync": {
|
||||
"trigger": "セッションログを同期",
|
||||
"import": "セッションをインポート",
|
||||
"resync": "同期",
|
||||
"imported": "セッションログから {{count}} 件のレコードをインポートしました",
|
||||
"upToDate": "セッションログは最新です",
|
||||
"failed": "セッション同期に失敗しました"
|
||||
},
|
||||
"totalRecords": "全 {{total}} 件",
|
||||
"modelPricing": "モデル料金",
|
||||
"loadPricingError": "料金データの読み込みに失敗しました",
|
||||
|
||||
@@ -1018,6 +1018,21 @@
|
||||
"unknownProvider": "未知供应商",
|
||||
"stream": "流",
|
||||
"nonStream": "非流",
|
||||
"source": "来源",
|
||||
"dataSources": "数据来源",
|
||||
"dataSource": {
|
||||
"proxy": "代理",
|
||||
"session_log": "会话日志",
|
||||
"codex_db": "Codex 数据库"
|
||||
},
|
||||
"sessionSync": {
|
||||
"trigger": "同步会话日志",
|
||||
"import": "导入会话",
|
||||
"resync": "同步",
|
||||
"imported": "从会话日志导入了 {{count}} 条记录",
|
||||
"upToDate": "会话日志已是最新",
|
||||
"failed": "会话同步失败"
|
||||
},
|
||||
"totalRecords": "共 {{total}} 条记录",
|
||||
"modelPricing": "模型定价",
|
||||
"loadPricingError": "加载定价数据失败",
|
||||
|
||||
Reference in New Issue
Block a user