Commit Graph

385 Commits

Author SHA1 Message Date
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
Feng Yue
58958cf246 fix ownership update issue 2025-09-02 18:53:42 +08:00
shaw
86c243e1a4 fix: 修复loading动画错误 2025-09-02 11:51:38 +08:00
Wesley Liddick
b1ca898dff Merge pull request #317 from f3n9/um-5
修复账户管理页中Azure/OpenAI类型账户调度状态不准确的问题
2025-09-02 11:29:27 +08:00
Feng Yue
9f3fff1f27 fix: treat OpenAI account isActive as string 2025-09-02 10:13:27 +08:00
Feng Yue
23cb44f60f fix: handle boolean account flags in OpenAI scheduler 2025-09-02 10:06:59 +08:00
Feng Yue
60428921a1 Fix schedulable flag for OpenAI and Azure accounts 2025-09-02 09:58:05 +08:00
Wesley Liddick
5406b5790c Merge pull request #308 from f3n9/um-5
增加用户管理及Azure/Gemini相关改进
2025-09-02 09:33:38 +08:00
Wesley Liddick
d0eef7e98e Merge pull request #314 from sczheng189/feat/5xx-error-circuit-breaker
feat: 改进5xx错误熔断机制和重置状态功能
2025-09-02 09:32:08 +08:00
sczheng189
f2c2bdf6d6 feat: 改进5xx错误熔断机制和重置状态功能
## 熔断机制优化
- 将5xx错误阈值从3次提升到10次,减少误触发
- 缩短临时错误恢复时间从60分钟到5分钟
- 支持所有5xx状态码(500-599)的统一处理

## 重置状态功能完善
后端 resetAccountStatus 新增清除:
- tempErrorAt 字段 (temp_error状态)
- sessionWindowStart/sessionWindowEnd 字段
- 5xx_errors Redis计数键

前端优化:
- 重置成功后强制刷新 loadAccounts(true)
- 避免缓存导致的状态显示不一致

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-01 21:39:39 +08:00
Feng Yue
68603bc046 Merge branch 'dev' into um-5 2025-09-01 12:19:53 +08:00
shaw
5cfa3cc72f feat: 添加精确的账户费用计算和时区支持
- 实现基于模型使用量的精确每日费用计算
- 添加 dateHelper 工具支持时区转换
- 移除未使用的 webhook 配置代码
- 清理环境变量和配置文件中的 webhook 相关设置
- 优化前端费用显示,使用后端精确计算的数据
- 添加 DEBUG_HTTP_TRAFFIC 调试选项支持

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-01 11:29:16 +08:00
Feng Yue
c979be5aab fix lint/format issues 2025-08-31 23:31:38 +08:00
Feng Yue
e0c926c53d Merge remote-tracking branch 'f3n9/main' into um-5 2025-08-31 23:21:12 +08:00
Feng Yue
50b372473c Merge remote-tracking branch 'f3n9/main' into um-5 2025-08-31 23:12:46 +08:00
iaineng
26438e0c9b fix: 修复Claude账户autoStopOnWarning字段无法更新的问题
在updateAccount方法的allowedUpdates数组中添加autoStopOnWarning字段,
解决通过管理后台API更新Claude账户时该字段被过滤掉的问题
2025-08-31 21:49:40 +08:00
shaw
9a46310238 fix: 修复会话窗口使用统计问题 2025-08-31 20:14:12 +08:00
shaw
e84c6a5555 feat: 实现基于费用的速率限制功能
- 新增 rateLimitCost 字段,支持按费用进行速率限制
- 新增 weeklyOpusCostLimit 字段,支持 Opus 模型周费用限制
- 优化速率限制逻辑,支持费用、请求数、token多维度控制
- 更新前端界面,添加费用限制配置选项
- 增强账户管理功能,支持费用统计和限制
- 改进 Redis 数据模型,支持费用计数器
- 优化价格计算服务,支持更精确的成本核算

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-31 17:27:37 +08:00
Feng Yue
0240a17c1e fix lint/format issues 2025-08-31 14:21:56 +08:00
Feng Yue
01274a6a96 Revert "add logs to fix azure request issue"
This reverts commit 2cf2574ebe.
2025-08-31 01:37:48 +08:00
Feng Yue
87c2f1dfe2 Revert "fix azure endpoint and api version issue"
This reverts commit 92f4fbcef3.
2025-08-31 01:37:18 +08:00
Feng Yue
7c4cbe6ed7 Revert "add debug log for headers and body of Azure OpenAI requests"
This reverts commit 70c8cb5aff.
2025-08-31 01:36:13 +08:00
Feng Yue
1762669de4 use proxy if configured in Gemini OAuth requests 2025-08-31 01:00:49 +08:00
Feng Yue
dc3d311def fix azure openai usage count issue 2025-08-30 20:45:01 +08:00
shaw
a54622e3d7 Revert "Merge pull request #292 from iRubbish/dev"
This reverts commit 9e8e74ce6b, reversing
changes made to 222f4e44fe.
2025-08-30 20:09:41 +08:00
shaw
3bc239e85c Merge branch 'main' into dev 2025-08-30 19:55:33 +08:00
Feng Yue
70c8cb5aff add debug log for headers and body of Azure OpenAI requests 2025-08-30 19:25:06 +08:00
Feng Yue
92f4fbcef3 fix azure endpoint and api version issue 2025-08-30 18:55:24 +08:00
Feng Yue
2cf2574ebe add logs to fix azure request issue 2025-08-30 18:46:46 +08:00
Feng Yue
c638c8b82c Merge remote-tracking branch 'f3n9/main' into um-5 2025-08-30 15:39:33 +08:00
Wesley Liddick
9e8e74ce6b Merge pull request #292 from iRubbish/dev
feat: 新增AD域控用户认证系统
2025-08-28 08:43:21 +08:00
Hg
fcc8387c24 feat: 增加Bark作为webhook渠道 2025-08-26 17:40:02 +08:00
iRubbish
8a5d4b5d8f feat: 完善AD域控用户系统,增加配置说明
- 完善用户API Key创建流程,移除名称编辑权限
- 清理硬编码敏感信息,改用环境变量配置
- 在README.md和.env.example中添加AD域控配置说明
- 修复ESLint no-shadow错误
- 删除测试文件test-fixed-auto-link.js

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-26 15:55:13 +08:00
iRubbish
82f545c3b0 保存当前API Key管理功能的修改
- 统一用户创建和admin创建API Key的逻辑
- 修复admin更新用户创建的API Key功能
- 用户创建API Key名称改为displayName
- 默认无限制配置

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-26 13:42:02 +08:00
Wesley Liddick
222f4e44fe Merge pull request #288 from sczheng189/feat/multi-group-scheduling
feat: 实现账户多分组调度功能
2025-08-26 08:58:33 +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
Wesley Liddick
6bcd7ed1fc Merge pull request #286 from sczheng189/feat/5xx-error-circuit-breaker
feat: 扩展熔断机制支持所有5xx错误码
2025-08-25 19:43:08 +08:00
sczheng189
5366dc70e1 fix: 修复重置账号状态后仍被认为不可用的bug
问题描述:
- 重置账号状态时虽然正确设置了 schedulable: 'true'
- 但在账号选择逻辑中缺少对 schedulable !== 'false' 的检查
- 导致重置后的账号仍被认为不可用

修复内容:
- selectAvailableAccount: 在 activeAccounts 过滤中添加 schedulable 检查
- selectAccountForApiKey: 在绑定账户和 sharedAccounts 过滤中添加 schedulable 检查
- 确保重置状态后的账号能正确被识别为可用

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-25 19:18:51 +08:00
sczheng189
f4f88091c1 feat: 扩展熔断机制支持所有5xx错误码
- 扩展错误检测从单一500错误到所有5xx错误码(500-599)
- 新增temp_error状态,连续3次5xx错误触发临时熔断
- 支持流式和非流式请求的统一5xx错误处理
- 添加定时清理机制,60分钟后自动恢复temp_error状态
- 完善错误计数和清理逻辑,提高系统可靠性

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-25 19:14:14 +08:00
iRubbish
7624c383e8 feat: 完整实现AD域控用户认证系统
主要功能:
- 新增LDAP服务连接AD域控服务器
- 实现多格式AD用户认证(sAMAccountName, UPN, 域\用户名, DN)
- 支持中文显示名和拼音用户名搜索
- 添加用户账户状态检查(禁用账户检测)
- 实现JWT token认证和用户会话管理

新增文件:
- src/services/ldapService.js - LDAP核心服务
- src/routes/ldapRoutes.js - AD认证API路由
- src/services/userMappingService.js - 用户映射服务
- web/admin-spa/src/views/UserDashboardView.vue - 用户控制台
- web/admin-spa/src/components/user/ - 用户组件目录

修改功能:
- ApiStatsView.vue 增加用户登录按钮和模态框
- 路由系统增加用户专用页面
- 安装ldapjs和jsonwebtoken依赖

技术特性:
- 多种认证格式自动尝试
- LDAP referral错误处理
- 详细认证日志和错误码记录
- 前后端完整用户认证流程

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-25 18:03:55 +08:00
Feng Yue
d5f5e0f4dd Merge branch 'main' into um-5 2025-08-25 17:19:24 +08:00
shaw
b426a759a8 feat: 支持后台配置webhook 2025-08-23 20:20:32 +08:00
shaw
74bcb99142 feat: 新增支持Azure OpenAI账户 2025-08-23 10:30:29 +08:00
shaw
102fc54e8e fix: 修复gemini转发代理ip未使用的问题 2025-08-21 10:55:05 +08:00
shaw
cb29b3f7e4 fix: 代理ip使用重构为统一方法 2025-08-20 23:21:32 +08:00
shaw
a45c832278 feat: 统一代理配置管理,支持IPv4/IPv6协议族选择
- 新增统一代理工具 ProxyHelper,支持 SOCKS5/HTTP/HTTPS 代理
- 添加 IPv4/IPv6 协议族配置选项,默认使用 IPv4 确保兼容性
- 移除 OpenAI 路由中硬编码的 family: 4 限制
- 统一 8 个服务文件中的代理创建逻辑,避免重复维护
- 支持 OAuth 和 token 交换过程中的代理使用
- 新增配置项:PROXY_USE_IPV4(默认 true)
- 向后兼容:现有配置无需手动更新

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-20 22:36:34 +08:00
mouyong
5af8913954 refactor(backend): 统一账户平台标识字段
WHAT: 统一 Claude 账户的平台标识,从 claude-oauth 改为 claude
WHY: 简化平台标识命名规范,提高前后端数据一致性,为多平台支持奠定基础
HOW: 在账户创建和查询接口中添加 platform 字段支持;更新 claudeAccountService 默认平台标识;保持向后兼容性,旧数据自动使用默认值
2025-08-20 21:40:24 +08:00
Feng Yue
77338276db Merge remote-tracking branch 'f3n9/main' into user-management-new 2025-08-18 15:32:17 +08:00
shaw
65ba0ffb8f feat: 优化 Gemini 项目ID处理逻辑
- 统一使用账户配置的项目ID,忽略客户端请求中的project参数
- 增强日志记录,更清晰地追踪项目ID的使用情况
- 移除无用的 geminiAuthInterceptor 中间件
- 移除调试用的 console.log

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-18 09:33:15 +08:00
shaw
3d1cd21bc4 fix: 修复 ESLint 错误和代码格式问题
- 修复 cacheMonitor.js 中未使用的变量 'name'
- 移除未使用的变量以通过 ESLint 检查
- 确保 npm run dev 能正常运行

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-17 16:54:08 +08:00