iaineng
782e912a0d
fix(oauth): auto-refresh expired tokens in fetchOAuthUsage
...
Replace direct token decryption with getValidAccessToken call to
enable automatic token expiration check and refresh. This fixes
authentication_error when fetching OAuth usage data with expired
access tokens.
2025-10-01 11:59:03 +08:00
iaineng
11c214449f
feat(api): add Claude OAuth usage endpoint with async loading
...
Add dedicated API endpoint to fetch Claude account OAuth usage data
asynchronously, improving user experience by eliminating the need for
multiple page refreshes to view session window statistics.
Backend changes:
- Add GET /admin/claude-accounts/usage endpoint for batch fetching
- Implement fetchOAuthUsage() to call Claude API /api/oauth/usage
- Add buildClaudeUsageSnapshot() to construct frontend data structure
- Add updateClaudeUsageSnapshot() to persist data to Redis
- Add _toNumberOrNull() helper for safe type conversion
- Update getAllAccounts() to return claudeUsage from Redis cache
Data structure:
- Store three window types: 5h, 7d, 7d-Opus
- Track utilization percentage and reset timestamps
- Calculate remaining seconds for each window
Performance optimizations:
- Concurrent batch requests using Promise.allSettled
- Graceful error handling per account
- Non-blocking async execution
2025-09-30 22:51:54 +08:00
Gemini Wen
87bd54d9ea
fix: 修复统一客户端标识的布尔值判断
...
将 useUnifiedClientId 的判断从直接布尔值比较改为字符串 'true' 比较,修复配置值为字符串时的判断问题。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-30 13:01:54 +08:00
shaw
fcf54565ec
chore: 其他文件修改
...
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-30 11:25:43 +08:00
shaw
4ab91f233f
refactor: 使用 claudeCodeValidator 统一验证逻辑
...
替换 _hasClaudeCodeSystemPrompt 方法,改用 claudeCodeValidator
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-30 11:25:35 +08:00
shaw
66b9b391d9
feat: 添加 Claude Agent SDK 系统提示词
...
新增 claudeOtherSystemPrompt3 支持 Agent SDK 格式
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-30 11:25:26 +08:00
shaw
4ad1ccc22c
fix: 适配 claude-vscode 客户端
...
扩展正则表达式以支持 claude-cli/2.0.0 (external, claude-vscode)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-30 11:25:18 +08:00
shaw
c19acf2b01
fix: contents.js依赖改为CommonJS
2025-09-29 14:48:43 +08:00
千羽
3e69f17330
feat: 重构和更新 Claude Code 验证器组件
...
- 重构 src/utils/contents.js,添加完整的 prompt 定义和相似度检测功能
- 删除重复的 src/utils/text-similarity.js 文件
- 更新 claudeCodeValidator.js 中的验证逻辑和错误处理
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-29 14:39:29 +09:00
shaw
b4d7ed06c5
fix: 修复5小时限制被停止调度未恢复的问题
2025-09-28 23:30:41 +08:00
shaw
aca2b1cccb
feat: 账号列表支持批量删除
2025-09-28 21:43:57 +08:00
shaw
5e015e87e0
style: 优化api-stats布局
2025-09-28 14:54:24 +08:00
shaw
b123cc35c1
feat: api-stats页面查询专属账号会话窗口
2025-09-28 14:36:38 +08:00
shaw
90dce32cfc
fix: 优化并发限制数的控制逻辑
2025-09-28 13:58:59 +08:00
shaw
5ce385d2bc
fix: 修复账号筛选平台是oai显示异常
2025-09-28 11:53:46 +08:00
shaw
e197fbdf80
Merge branch 'pr-485' into dev
2025-09-28 09:45:03 +08:00
shaw
e675c5878e
style: 仪表板组件样式优化
2025-09-27 23:07:39 +08:00
shaw
ea28222c71
feat: 支持账号维度的数据统计
2025-09-27 22:55:06 +08:00
yaogdu
d1bbc71796
feat: 🎸 export csv from web and support hourly TTL of key
2025-09-27 14:11:54 +08:00
shaw
0e724c9901
feat: oai账号增加402适配
2025-09-26 17:29:50 +08:00
shaw
f97db927c0
style: 调整standardGeminiRoutes缩进格式
2025-09-26 10:47:07 +08:00
shaw
25d1c3f74e
fix: apikey的服务权限问题修复
2025-09-25 22:51:39 +08:00
shaw
66bb3419b7
fix: 修复oai专属绑定401导致重复触发通知的bug
2025-09-25 22:32:04 +08:00
shaw
c15ef0b6ae
feat: 适配codex用量数据
2025-09-25 17:23:52 +08:00
shaw
991dd1436f
fix: 修复apikey的服务权限失效问题
2025-09-25 17:23:52 +08:00
shaw
f105b1cc31
fix: 修复codex调度问题
2025-09-25 16:05:56 +08:00
shaw
79fb5fb072
fix: 去除无用参数
2025-09-25 15:08:04 +08:00
shaw
69cf8646e9
fix: cc提示词检测暂时排除haiku模型2
2025-09-25 14:22:36 +08:00
shaw
749ebf0a82
fix: cc提示词检测暂时排除haiku模型
2025-09-25 14:18:16 +08:00
shaw
ad672c3c4c
fix: 修复openai-respons计费问题
2025-09-25 11:31:30 +08:00
shaw
54bf1ce49b
fix: claude code兼容sdk-cli
2025-09-25 10:10:43 +08:00
shaw
e1a481af46
fix: 修复提示词检测引起的compact失败
2025-09-24 23:22:21 +08:00
shaw
b0077cecd7
fix: 修复s5代理不可用的问题
2025-09-24 19:21:56 +08:00
shaw
0a66609c1b
fix: 修复codex限流自动恢复问题
2025-09-24 16:47:55 +08:00
shaw
ad443ea18a
fix: 调整Claude Code相似度检测并恢复401处理
2025-09-24 15:04:39 +08:00
千羽
9c3914bf79
feat: enhance Claude Code client detection with similarity matching
...
- Add string-similarity library for robust prompt comparison
- Extract Claude Code system prompts to separate contents module
- Implement similarity-based validation with configurable thresholds
- Support different validation logic for Haiku vs other Claude models
- Fix validation to properly handle array format system prompts
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-24 11:31:44 +09:00
shaw
24d1f0a494
fix: 修复统一user-agent问题
2025-09-23 17:35:10 +08:00
shaw
303c0c4e15
feat: 增加claude code客户端识别
2025-09-23 16:41:26 +08:00
shaw
5a2199f9a9
fix: claude提示词检测逻辑修复
2025-09-23 16:29:17 +08:00
shaw
0ba048aced
feat: 优化专属账号删除逻辑
2025-09-23 15:48:38 +08:00
shaw
86668c3de9
fix:修复1.1.147版本启动问题
2025-09-22 13:53:56 +08:00
shaw
ff73375f0a
fix: 优化codex错误抛出 增强客户端限制条件
2025-09-22 11:56:54 +08:00
shaw
f9c397cc1f
feat: api-stats页面增加周限总限查询
2025-09-21 14:22:34 +08:00
shaw
588b181eb9
fix: 修复服务账户数量少了response账户
2025-09-20 22:03:43 +08:00
shaw
3628bb2b7a
fix: 修复openai输入token计算问题
2025-09-20 21:43:48 +08:00
shaw
08c2b7a444
fix: 修复PR #458中的totalCostLimit功能问题
...
主要修复:
- 移除重复的totalUsageLimit字段,统一使用totalCostLimit
- 删除auth.js中重复的总费用限制检查逻辑
- 删除admin.js中重复的totalCostLimit验证代码
- 更新所有前端组件,移除totalUsageLimit引用
功能改进:
- 确保totalCostLimit作为永久累计费用限制正常工作
- 与dailyCostLimit(每日重置)功能互补
- 适用于预付费、一次性API Key场景
测试:
- 删除有逻辑错误的test-total-usage-limit.js
- 创建新的test-total-cost-limit.js验证功能正确性
- 所有测试通过,功能正常工作
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-20 17:37:20 +08:00
itzhan
a929ff4242
chore: fix prettier formatting
2025-09-20 08:27:41 +08:00
itzhan
200149b9ee
chore: fix prettier formatting
2025-09-19 22:41:46 +08:00
itzhan
ec28b66e7f
feat: 给key增加总用量限制
2025-09-19 21:57:24 +08:00
shaw
6e98c46371
fix: 修复oai代理密码保存问题
2025-09-18 19:47:09 +08:00