Commit Graph

36 Commits

Author SHA1 Message Date
shaw
c79fdc4d71 feat: 增加Claude会话强制绑定 2025-12-08 16:06:23 +08:00
DaydreamCoding
f74f77ef65 feat(concurrencyManagement): implement concurrency status management API and enhance concurrency handling in middleware 2025-12-06 17:23:42 +08:00
shaw
77124aa501 fix: droid去掉count_tokens端点 2025-10-15 15:50:04 +08:00
shaw
d6a9beff2f feat: 适配新版本gemini 2025-10-14 11:24:27 +08:00
shaw
1145fb7b7d fix: 修复apikey的并发控制问题 2025-10-13 09:48:13 +08:00
shaw
66fe3cf74a fix: 优化count_tokens接口不受并发跟客户端限制 2025-10-10 17:16:10 +08:00
shaw
42db271848 feat: droid平台账户数据统计及调度能力 2025-10-10 15:13:45 +08:00
shaw
90dce32cfc fix: 优化并发限制数的控制逻辑 2025-09-28 13:58:59 +08:00
shaw
ff73375f0a fix: 优化codex错误抛出 增强客户端限制条件 2025-09-22 11:56:54 +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
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
root
cd5573ecde Fix Prettier formatting issues
- Remove trailing whitespace and fix indentation in src/app.js
- Format whitespace in src/middleware/auth.js
- Fix formatting and add missing newline in src/middleware/browserFallback.js

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-10 09:13:51 +00:00
root
bdae9d6ceb feat: 添加Chrome插件兜底支持,解决第三方插件401错误问题
• 新增browserFallback中间件,自动识别并处理Chrome插件请求
• 增强CORS支持,明确允许chrome-extension://来源
• 优化请求头过滤,移除可能触发Claude CORS检查的浏览器头信息
• 完善401错误处理逻辑,避免因临时token问题导致账号被错误停用

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-10 07:48:41 +00:00
shaw
e824858d60 feat: claude账户支持使用统一的客户端标识 2025-09-08 11:35:44 +08:00
Feng Yue
50b372473c Merge remote-tracking branch 'f3n9/main' into um-5 2025-08-31 23:12:46 +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
77338276db Merge remote-tracking branch 'f3n9/main' into user-management-new 2025-08-18 15:32:17 +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
Feng Yue
2756671117 fix: user stats 2025-08-14 11:38:23 +08:00
Feng Yue
eb150b4937 feat: 实现完整用户管理系统和LDAP认证集成
- 新增LDAP认证服务支持用户登录验证
- 实现用户服务包含会话管理和权限控制
- 添加用户专用路由和API端点
- 扩展认证中间件支持用户和管理员双重身份
- 新增用户仪表板、API密钥管理和使用统计界面
- 完善前端用户管理组件和路由配置
- 支持用户自助API密钥创建和管理
- 添加管理员用户管理功能包含角色权限控制

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-14 11:36:45 +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
千羽
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
mouyong
9fca0b0c20 feat: gemini 支持 2025-08-05 01:19:23 +08:00
shaw
ecfc1050d3 feat: 优化移动端响应式设计
- 优化所有页面的移动端适配(手机、平板、PC)
- 修复AccountsView移动端状态显示和按钮功能问题
- 修复ApiKeysView移动端详情展开显示问题
- 移除ApiKeysView不必要的查看按钮
- 修复Dashboard页面PC版时间筛选按钮布局
- 改进所有组件的响应式设计
- 删除dist目录避免构建文件冲突

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-03 22:34:41 +08:00
Alfonsxh
7cdb75bdaa fix: 优化请求日志记录格式
- 将请求开始日志从 logger.request 改为 logger.info
- 调整请求完成日志的格式,使用更结构化的参数传递

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-30 11:35:22 +08:00
KevinLiao
ac1e367a69 feat: 增加每日费用限制 2025-07-27 14:47:59 +08:00
KevinLiao
b8c7c3e9f5 feat: 增加APIKey 客户端限制功能 2025-07-25 23:36:48 +08:00
shaw
2f4730baba 优化: 替换第三方CDN资源以提升加载速度
- 将所有第三方资源从 bootcdn 迁移到 cdnjs.cloudflare.com
- 移除 SRI 完整性校验以避免哈希值不匹配问题
- 添加 DNS 预取和预连接以加速资源加载
- 调整脚本加载顺序,确保依赖关系正确
- 保持所有库版本号不变 (Vue 3.3.4, Element Plus 2.4.4, Chart.js 4.4.0)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-23 11:15:33 +08:00
shaw
9ad7feb94c fix: 修复 OpenAI 路由中的 req.apiKeyData undefined 错误
- 将所有路由中的 req.apiKeyData 改为 req.apiKey(与中间件一致)
- 在 authenticateApiKey 中间件中添加缺失的字段(permissions, geminiAccountId, usage)
- 修复 openaiClaudeRoutes.js、openaiGeminiRoutes.js 和 geminiRoutes.js 中的引用错误
- 确保 API 权限检查正常工作

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-22 13:08:24 +08:00
shaw
088ce266ba feat: 添加API Key时间窗口限流功能并移除累计总量限制
- 新增时间窗口限流功能,支持按分钟设置时间窗口
- 支持在时间窗口内限制请求次数和Token使用量
- 移除原有的累计总量限制,只保留时间窗口限制
- Token统计包含所有4种类型:输入、输出、缓存创建、缓存读取
- 前端UI优化,明确显示限流参数的作用范围
- 限流触发时提供友好的错误提示和重置时间

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-20 15:58:00 +08:00
shaw
f962083752 feat: 为API Key添加模型限制功能
- 前端:在API Key创建和编辑表单中添加模型限制开关和标签输入
- 前端:支持动态添加/删除限制的模型列表
- 后端:更新API Key数据结构,新增enableModelRestriction和restrictedModels字段
- 后端:在中转请求时检查模型访问权限
- 修复:Enter键提交表单问题,使用@keydown.enter.prevent
- 优化:限制模型数据持久化,关闭开关时不清空数据

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-19 20:54:26 +08:00
shaw
567e3b25aa feat: 优化并发控制和移除冗余限制功能
主要改进:
1. 改进并发控制机制
   - 使用 once 代替 on 避免重复监听
   - 监听多个事件确保可靠性(close、finish)
   - 支持客户端断开时立即释放并发槽位

2. 支持非流式请求的客户端断开处理
   - 客户端断开时立即中断上游请求
   - 避免资源浪费和不必要的 API 调用

3. 移除 requestLimit(请求数限制)功能
   - 移除配置和验证逻辑
   - 保留请求统计用于监控分析

4. 移除速率限制(Rate Limit)功能
   - 移除 RATE_LIMIT_* 配置
   - 简化中间件逻辑
   - 避免与并发控制重复

现在系统仅保留:
- Token 使用量限制
- 并发数限制(更精确的资源控制)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-16 14:40:37 +08:00
shaw
08f93e9872 fix: 修复并发计数器在请求异常时不能正确减少的问题
- 增强事件监听机制
  - 监听 req 的 close 和 aborted 事件
  - 监听 res 的 finish 和 error 事件
  - 使用标志位确保只减少一次计数

- 改进日志记录
  - 增加并发计数增减的详细日志
  - 记录请求关闭和中断事件

- 确保计数器安全性
  - 使用 Lua 脚本原子操作防止负数
  - 优化 Redis 操作逻辑

- 增强管理界面
  - API Keys 列表显示当前并发数
  - 并发数超过 0 时用橙色标记
  - 显示当前并发数/限制数格式

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-16 10:21:17 +08:00
shaw
12b41ceb25 feat: 添加API Key并发控制和编辑功能
- 新增API Key并发控制功能
  - 创建API Key时可设置并发限制(0为不限制)
  - 在认证中间件中实现并发检查
  - 使用Redis原子操作确保计数准确
  - 添加自动清理机制处理异常情况

- 新增API Key编辑功能
  - 支持修改Token限制和并发限制
  - 前端添加编辑按钮和模态框
  - 后端限制只能修改指定字段

- 其他改进
  - 添加test-concurrency.js测试脚本
  - 添加详细的功能说明文档
  - 所有代码通过ESLint检查

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-16 09:48:07 +08:00
shaw
b1ca3f307e first commit 2025-07-14 18:14:13 +08:00