Commit Graph

58 Commits

Author SHA1 Message Date
shaw
2f0839c7da feat: 合并 PR #578 并接入统一定价服务 2025-10-16 14:12:25 +08:00
shaw
d606cb2e38 fix: 优化模型价格文件更新策略 2025-10-16 10:46:45 +08:00
liangjie.wanglj
b9d2e855f3 claude console类型中增加claude-haiku-4-5-20251001、GLM、Kimi、Qwen模型支持;增加计费消息通知;Claude console 及 ccr模型匹配大小写不敏感 2025-10-16 09:53:42 +08:00
shaw
506bd5a205 fix: 修复redis密码传参问题 2025-09-28 15:52:33 +08:00
shaw
b9c606e82e Merge pr-484 2025-09-28 09:57:40 +08:00
yaogdu
d1bbc71796 feat: 🎸 export csv from web and support hourly TTL of key 2025-09-27 14:11:54 +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
df634a4565 chore: fix lint formatting 2025-09-20 09:20:18 +08:00
itzhan
ec28b66e7f feat: 给key增加总用量限制 2025-09-19 21:57:24 +08:00
maplegao
a71f0e58a2 修复README.md中 版本更新不work问题, 重启脚本中没有stop 2025-09-06 14:27:18 +08:00
sususu
86f92a774e feat: 增强API Key 导入处理,支持明文与哈希值自动识别以实现脚本批量导入apiKey 2025-09-03 21:40:45 +08:00
sczheng189
9c7ec8758d resolve: 解决与upstream/dev的合并冲突
- 合并admin.js中的groupIds和autoStopOnWarning参数
- 统一AccountForm.vue中的错误提示文案和平台判断逻辑
- 保留AccountsView.vue中的分组过滤和ungrouped功能
- 确保Azure OpenAI账户创建和更新逻辑完整性

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-02 20:32:42 +08:00
sczheng189
37e6c14eac feat: 完善账户多分组功能和Azure OpenAI支持
主要功能:
- 实现账户多分组调度功能完整支持
- 修复Azure OpenAI账户优先级显示问题(前端条件判断缺失)
- 修复未分组筛选功能失效(API参数处理)
- 修复Azure OpenAI账户创建错误调用Gemini API的问题
- 完善各平台分组信息支持和使用统计显示
- 统一删除账户时的分组清理逻辑
- 添加前端请求参数处理支持

技术改进:
- 前端支持多平台账户请求构造
- 后端统一groupInfos返回格式
- API客户端完善查询参数处理

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-02 20:16:20 +08:00
shaw
19eaed2f32 fix: 修复crs脚本偶尔重启失败的问题 2025-09-01 11:35:49 +08:00
sczheng189
e69ab2161d feat: 实现账户多分组调度功能
- 添加账户分组管理功能,支持创建、编辑、删除分组
- 实现基于分组的账户调度逻辑
- 添加分组权重和优先级支持
- 提供测试脚本验证多分组调度功能
- 修复代码格式化问题(统一使用LF换行符)

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-25 20:11:18 +08:00
mouyong
5af8913954 refactor(backend): 统一账户平台标识字段
WHAT: 统一 Claude 账户的平台标识,从 claude-oauth 改为 claude
WHY: 简化平台标识命名规范,提高前后端数据一致性,为多平台支持奠定基础
HOW: 在账户创建和查询接口中添加 platform 字段支持;更新 claudeAccountService 默认平台标识;保持向后兼容性,旧数据自动使用默认值
2025-08-20 21:40:24 +08:00
shaw
681cb8cd82 feat: 优化 Claude 模型缓存费用计算,支持 5 分钟和 1 小时两种缓存类型
- 在 pricingService 中硬编码 1 小时缓存价格(Opus: $30/MTok, Sonnet: $6/MTok, Haiku: $1.6/MTok)
- 更新 usage 捕获逻辑以分别记录 ephemeral_5m 和 ephemeral_1h 缓存 tokens
- 改进费用计算逻辑,正确计算两种缓存类型的费用
- 新增 recordUsageWithDetails 方法支持详细的缓存数据
- 保持向后兼容性,支持旧的数据格式
- 删除测试脚本 test-openai-refresh.js
- 修复 OpenAI token 刷新逻辑

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 22:31:20 +08:00
shaw
812e98355f feat: 实现 OpenAI token 自动刷新功能并优化账户管理界面
主要更改:
1. OpenAI Token 自动刷新
   - 实现 refreshAccessToken 函数,支持 OAuth 2.0 refresh_token grant type
   - 使用 Codex CLI 官方 CLIENT_ID (app_EMoamEEZ73f0CkXaXp7hrann)
   - 支持 SOCKS5 和 HTTP/HTTPS 代理
   - 自动更新 access token、id token 和 refresh token

2. 账户管理界面优化
   - 移除手动刷新 token 按钮(桌面端和移动端)
   - 保留后端自动刷新机制
   - 优化代码结构,删除不再需要的函数和变量

3. 测试和文档
   - 添加 test-openai-refresh.js 测试脚本
   - 创建详细的实现文档

技术细节:
- Token 端点: https://auth.openai.com/oauth/token
- 默认有效期: 1小时
- 加密存储: AES-256-CBC

所有平台现在都支持自动 token 刷新:
 Claude - OAuth 自动刷新
 Gemini - Google OAuth2 自动刷新
 OpenAI - OAuth 自动刷新(新实现)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-15 16:56:44 +08:00
shaw
f462684f97 feat: 实现OpenAI账户管理和统一调度系统
- 新增 OpenAI 账户管理服务,支持多账户轮询和负载均衡
- 实现统一的 OpenAI API 调度器,智能选择最优账户
- 优化成本计算器,支持更精确的 token 计算
- 更新模型定价数据,包含最新的 OpenAI 模型价格
- 增强 API Key 管理,支持更灵活的配额控制
- 改进管理界面,添加教程视图和账户分组管理
- 优化限流配置组件,提供更直观的用户体验

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 13:58:43 +08:00
mouyong
8bdf495ffa feat: enhance monitoring and Gemini service functionality
- Add enhanced monitoring scripts (monitor-enhanced.sh, status-unified.sh)
- Improve Gemini relay service with better error handling and token management
- Update authentication middleware for better compatibility
- Add new package dependencies for enhanced functionality
- Update .gitignore and app configuration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-09 14:06:56 +08:00
shaw
8085a00d24 chore: 更新 .gitignore 和管理脚本
- 在 .gitignore 中添加更多备份文件忽略规则
- 在 manage.sh 脚本中添加切换分支功能
- 优化脚本执行权限设置逻辑

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-08 20:36:33 +08:00
shaw
66857af148 feat: 在 API Keys 页面使用统计栏添加最后使用时间显示
- 在桌面端表格视图的使用统计列中增加最后使用时间
- 在移动端卡片视图的统计区域增加最后使用时间
- 添加 formatLastUsed 函数格式化时间显示
- 时间显示规则与 Accounts 页面保持一致(刚刚/X分钟前/X小时前/X天前/具体日期)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-08 20:27:20 +08:00
shaw
31bdb4aa8c feat: add comprehensive 401 error handling and account status management
- Add 401 error detection and automatic account suspension after 3 consecutive failures
- Implement account status reset functionality for clearing all error states
- Enhance admin interface with status reset controls and improved status display
- Upgrade service management script with backup protection and retry mechanisms
- Add mandatory code formatting requirements using Prettier
- Improve account selector with detailed status information and color coding

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-08 00:35:26 +08:00
千羽
8a74bf5afe refactor: standardize code formatting and linting configuration
- Replace .eslintrc.js with .eslintrc.cjs for better ES module compatibility
- Add .prettierrc configuration for consistent code formatting
- Update package.json with new lint and format scripts
- Add nodemon.json for development hot reloading configuration
- Standardize code formatting across all JavaScript and Vue files
- Update web admin SPA with improved linting rules and formatting
- Add prettier configuration to web admin SPA

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-07 18:19:31 +09:00
andersonby
657b7b0a05 feat: Add test scripts for Bedrock models and model mapping functionality 2025-08-06 19:23:36 +08:00
shaw
c972ea485d fix: manage.sh在centos上异常的问题 2025-08-06 14:18:56 +08:00
shaw
0c1eb3eae2 fix: 修复多个部署和管理脚本问题
- 修复workflow中web-dist分支推送node_modules的问题
  - 添加.gitignore文件排除node_modules
  - 使用git add --all -- ':\!node_modules'命令排除node_modules目录

- 修复scripts/manage.sh脚本问题
  - 移除软链创建时的覆盖询问,默认使用代码中的最新版本
  - 安装时自动给scripts/manage.sh添加执行权限
  - 创建软链时确保目标脚本有执行权限

- 修复CentOS 9系统上服务启动失败的问题
  - 改进systemd服务配置,添加环境变量和日志目录创建
  - 添加systemctl daemon-reload确保配置生效
  - 增加启动状态检查和失败时的npm回退机制

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-06 13:50:30 +08:00
shaw
616079b16b fix: 修复 web-dist 分支 README 文件日期变量替换问题
- 移除 heredoc 的单引号,允许变量和命令替换
- 确保 Build Date 能正确显示实际构建时间
- 同时修复了 workflow 和测试脚本中的相同问题

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-06 10:27:05 +08:00
shaw
1a423d3afd feat: 优化前端构建分发和模型价格更新机制
1. 前端构建分发优化:
   - 修改 GitHub Actions workflow,构建前端后推送到 web-dist 分支
   - 更新 manage.sh 安装脚本,从 web-dist 分支获取预构建文件
   - 解决部分机器无法本地编译前端的问题
   - 添加测试脚本 test-web-dist.sh 验证流程

2. 模型价格更新功能:
   - 添加手动更新模型价格脚本 update-model-pricing.js
   - 新增 npm run update:pricing 命令
   - 在 manage.sh 添加 update-pricing 命令和菜单选项
   - 支持备份、进度显示和统计信息

3. 其他改进:
   - 优化安装流程,减少对 Node.js 环境的依赖
   - 提供多种更新模型价格的方式
   - 改进错误处理和回退机制

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-06 10:24:03 +08:00
shaw
52718ef608 chore: 更新项目配置文件
- 更新 Docker 配置和构建脚本
- 优化项目文档和部署脚本

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-04 10:32:22 +08:00
shaw
29b331c7b4 fix: 修复 manage.sh 脚本软链接创建时的路径问题
- 修复找不到脚本文件 /root/claude-relay-service/app/manage.sh 的错误
- 优先使用项目中的 $APP_DIR/scripts/manage.sh 路径
- 改进 load_config 函数以支持不同的项目目录结构
- 添加 symlink 命令执行前的检查,确保 APP_DIR 已设置
- 增加详细的诊断信息输出,方便调试路径问题

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-03 23:17:05 +08:00
shaw
a5c7eeaf84 fix: 修复专属账号下拉框,仅显示dedicated类型账号
- 修改CreateApiKeyModal和EditApiKeyModal的过滤逻辑
- 专属账号下拉框只显示accountType='dedicated'的账号
- 移除accountType='group'的账号,这些账号通过分组调度
- 更新标签文字为'专属账号'以更准确描述
2025-08-03 22:34:44 +08:00
shaw
9c9afe1528 feat: 实现账户分组管理功能和优化响应式设计
主要更新:
- 实现账户分组管理功能,支持创建、编辑、删除分组
- 支持将账户添加到分组进行统一调度
- 优化 API Keys 页面响应式设计,解决操作栏被隐藏的问题
- 优化账户管理页面布局,合并平台/类型列,改进操作按钮布局
- 修复代理信息显示溢出问题
- 改进表格列宽分配,充分利用屏幕空间

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-03 22:34:43 +08:00
KevinLiao
d93ce8713d fix: 修复session窗口计算问题 2025-07-31 09:15:33 +08:00
shaw
321be986a6 feat: 优化仪表盘数据展示和用户体验
- 优化实时TPM显示格式,添加智能单位(K/M)
- 折线图tooltip添加token数单位格式化
- API Keys使用趋势图增加USD金额计算和显示
- 实现鼠标悬浮时数据倒序展示,前3名添加🥇🥈🥉标识
- 后端API添加费用计算支持
- 删除测试脚本,保持代码整洁

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-30 15:37:58 +08:00
shaw
21461863af fix: 修复实时RPM/TPM指标显示为0的问题
- 添加调试日志以追踪数据读取过程
- 修复getRealtimeSystemMetrics中的数据验证逻辑
- 添加测试脚本用于验证时间戳匹配问题
- 改进错误处理和日志记录

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-30 15:37:58 +08:00
KevinLiao
27efca3afb Merge branch 'main' of https://github.com/Wei-Shaw/claude-relay-service 2025-07-30 08:22:05 +08:00
KevinLiao
fddd5ee3e9 feat: 新增标准Claude Console API账号支持 2025-07-30 08:19:44 +08:00
shaw
25094fe5e7 feat(pricing): 添加模型价格文件本地fallback机制 2025-07-29 22:58:44 +08:00
shaw
f6948a04f6 Merge pull request #106 from kevinconan/main - feat: 账号管理页面,给Claude账号添加了会话窗口管理与显示 2025-07-29 11:08:56 +08:00
KevinLiao
718733b78b feat: 增加账号session窗口管理与显示。后续可以据此优化账号轮转逻辑。
scripts目录有相关管理脚本,请自行探索
2025-07-28 15:51:38 +08:00
shaw
4913be3b21 Merge remote-tracking branch 'origin/main' into dev 2025-07-28 09:30:33 +08:00
shaw
25ab1575ed feat: 改进 Gemini token 刷新测试脚本和添加解密测试脚本
- 修正加密盐值为 'gemini-account-salt'(之前错误使用了其他值)
- 在 test-gemini-refresh.js 中添加详细的调试信息
  - 显示配置信息和加密参数
  - 显示原始加密数据
  - 尝试手动解密并显示结果
  - 更详细的错误信息
- 添加 test-gemini-decrypt.js 用于单独测试解密功能

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-26 13:56:52 +08:00
shaw
24858f7e51 chore: 删除调试加解密相关脚本
根据用户要求删除临时调试脚本,准备重新分析加密流程

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-26 13:47:34 +08:00
shaw
adb1868899 feat: 添加修复默认密钥加密的 Gemini 账户脚本
- 检测使用默认密钥加密的数据
- 尝试用默认密钥解密后重新用当前密钥加密
- 解决密钥变更导致的解密失败问题

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-26 12:37:41 +08:00
shaw
b3cd97ab18 feat: 添加 Gemini token 修复和更新脚本
- fix-gemini-encryption.js: 诊断和修复加密问题
- update-gemini-token.js: 手动更新 refresh token 的工具

解决线上环境加密密钥不一致导致的解密失败问题

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-26 12:27:06 +08:00
shaw
8f0da8e914 fix: 修复 Gemini 解密调试脚本的密钥生成逻辑
- 使用 config.security.encryptionKey 而不是直接读取环境变量
- 添加 crypto.scryptSync 和 ENCRYPTION_SALT 以匹配实际加密逻辑
- 显示实际使用的加密配置信息

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-26 12:18:57 +08:00
shaw
a939fcebac feat: 添加 Gemini refreshToken 解密调试脚本
- 检查环境变量中的 ENCRYPTION_KEY
- 显示加密数据的格式信息
- 尝试新旧两种解密方法
- 输出详细的调试信息帮助定位问题

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-26 12:16:08 +08:00
shaw
71c2ef5d6d fix: 修复 Gemini token 刷新测试脚本的逻辑问题
- 移除错误的 refreshToken 占位符判断
- 直接使用 getAccount 获取解密后的完整账户信息
- 只有真正没有 refresh token 时才跳过测试

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-26 12:01:56 +08:00