feat: add token usage tracking and leaderboard
- Add token_usage table with composite unique index for claw_id + date - Add API endpoints: POST /token, GET /token/leaderboard, GET /token/stats - Add TokenLeaderboard component with daily/total period toggle - Add CLI commands: `token` and `stats` for reporting and viewing usage - Add Redis caching for leaderboard with 1-minute TTL - Add shared utilities: authenticateRequest, getTodayDateString - Use UPSERT pattern for atomic token updates - Add i18n translations (en/zh) for new UI elements
This commit is contained in:
@@ -27,6 +27,14 @@
|
||||
"title": "区域排名",
|
||||
"noData": "暂无数据"
|
||||
},
|
||||
"tokenLeaderboard": {
|
||||
"title": "Token 排行榜",
|
||||
"daily": "今日排名",
|
||||
"total": "总排名",
|
||||
"noData": "暂无 token 数据",
|
||||
"tokens": "{count} tokens",
|
||||
"inputOutput": "{input} 输入 / {output} 输出"
|
||||
},
|
||||
"clawFeed": {
|
||||
"title": "实时动态",
|
||||
"waiting": "等待龙虾活动中...",
|
||||
|
||||
Reference in New Issue
Block a user