KevinLiao
|
375d70ee1f
|
feat: APIKeys 列表,统计周期选项增加今日。
|
2025-07-27 12:03:22 +08:00 |
|
shaw
|
2a6bb2ab01
|
feat: 改进 Gemini token 刷新机制和错误处理
- Token 刷新成功后自动将账户状态更新为 active
- 清空之前的错误信息
- 确保账户在成功刷新后可以正常使用
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-07-26 14:36:28 +08:00 |
|
shaw
|
4789c03ea3
|
fix: 修复 Gemini token 刷新时的二次解密错误
- refreshAccountToken 中的 account.refreshToken 已经是解密后的值
- 移除多余的 decrypt() 调用,避免二次解密导致的错误
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-07-26 14:34:45 +08:00 |
|
shaw
|
3d13542fff
|
fix: 修复 Gemini 账户 refreshToken 解密错误
- 修复 updateAccount 中对已解密数据的二次解密问题
- 改进解密函数,使用固定长度的 IV 避免冒号分隔符问题
- 确保 refreshToken 能正确存储和使用
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-07-26 12:10:03 +08:00 |
|
shaw
|
dd73045223
|
feat: 改进 Gemini token 刷新机制和错误处理
- 修复 token 刷新时的错误处理逻辑
- 添加详细的错误日志记录
- 新增 test-gemini-refresh.js 测试脚本
- 更新 CLAUDE.md 文档,添加 Gemini token 刷新故障排除指南
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-07-26 11:41:17 +08:00 |
|
Wesley Liddick
|
383f33fa77
|
Merge pull request #72 from kevinconan/main
feat: 增加APIKey 客户端限制功能
|
2025-07-26 11:03:06 +08:00 |
|
KevinLiao
|
b8c7c3e9f5
|
feat: 增加APIKey 客户端限制功能
|
2025-07-25 23:36:48 +08:00 |
|
leslie
|
578d3ca34b
|
重复计次修复
|
2025-07-25 22:08:30 +08:00 |
|
leslie
|
53e0577e19
|
添加claude账号维度计算token费用前端修复
|
2025-07-25 21:48:54 +08:00 |
|
leslie
|
1cf70a627f
|
添加claude账号维度计算token费用
|
2025-07-25 21:36:17 +08:00 |
|
leslie
|
5522967792
|
添加claude账号维度计算token费用
|
2025-07-25 21:27:17 +08:00 |
|
leslie
|
4325de90e1
|
解决轮询问题
|
2025-07-25 20:27:20 +08:00 |
|
shaw
|
7936f1aa21
|
Merge branch 'dev'
|
2025-07-25 15:36:07 +08:00 |
|
shaw
|
3eba158387
|
fix: 修复管理员登录在Redis缓存失效后无法登录的问题
- 在登录时如果Redis中没有管理员凭据,自动从init.json重新加载
- 重新加载时不设置过期时间,避免24小时后再次失效
- 保持init.json作为唯一真实数据源的设计原则
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-07-25 15:30:50 +08:00 |
|
KevinLiao
|
e8d795713a
|
feat: API页面增加统计时间选择
|
2025-07-25 10:42:19 +08:00 |
|
KevinLiao
|
f614d54ab5
|
fix: APIKey列表费用及Token显示不准确的问题,目前显示总数
feat: 增加APIKey过期设置,以及到期续期的能力
|
2025-07-25 09:53:16 +08:00 |
|
shaw
|
afdfdc8fe7
|
feat: 支持通过 LOG_LEVEL 环境变量动态设置日志级别
- 允许在不修改配置文件的情况下调整日志级别
- 便于生产环境调试和故障排查
- 环境变量优先级高于配置文件
|
2025-07-24 14:18:45 +08:00 |
|
Wesley Liddick
|
b67cf05f63
|
Merge pull request #52 from mouyong/patch-1
修复用户提供的 密钥太短导致无法保存授权的问题
|
2025-07-23 22:58:58 +08:00 |
|
mouyong
|
9c96f18a7c
|
Update sessionHelper.js
|
2025-07-23 22:35:41 +08:00 |
|
mouyong
|
33561bcc80
|
修复用户提供的 密钥太短导致无法保存授权的问题
|
2025-07-23 22:34:26 +08:00 |
|
shaw
|
3553f5cc1f
|
fix: 修复流式响应的 Parse Error 和缓冲问题
主要修改:
1. 从 compression 中间件中排除 SSE 流式响应,避免压缩导致的缓冲
2. 移除导致 Parse Error 的 res.flushHeaders() 调用
3. 改进流式响应的错误处理,发送 SSE 错误事件而不是破坏流
4. 在写入数据前检查流状态,避免写入已销毁的流
5. 优化响应结束时的处理逻辑,确保缓冲区数据正确处理
这些修改确保了流式请求能够正常显示打字机效果,同时保留了 usage token 收集功能。
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-07-23 16:13:07 +08:00 |
|
shaw
|
1e372dd365
|
fix: 修复流式响应缓冲问题,实现真正的实时流传输
- 配置 compression 中间件排除 SSE 流式响应,避免压缩导致的缓冲
- 添加 X-Accel-Buffering: no 响应头,禁用 Nginx 等代理的缓冲
- 使用 res.flushHeaders() 立即发送响应头
- 禁用 Nagle 算法确保数据立即发送
- 在每次写入流数据后调用 flush() 确保实时传输
这些修复确保了流式请求能够正常显示打字机效果,数据从上游 Claude API 接收后能够立即转发给客户端。
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-07-23 15:56:27 +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
|
d6675a4d8e
|
feat: 添加 /claude/v1/messages 路由别名并优化非 Claude Code 客户端支持
- 添加 /claude 路由作为 /api 的别名,支持 /claude/v1/messages 端点
- 实现智能判断请求来源,通过 user-agent 和系统提示词识别真实的 Claude Code 请求
- 为非 Claude Code 客户端自动设置系统提示词和必要的 headers
- 优化 headers 更新逻辑,只有真实的 Claude Code 请求才更新缓存
- 确保 /api 和 /claude 路由功能完全一致
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-07-22 21:07:25 +08:00 |
|
shaw
|
e2cece6162
|
fix 修复x-request-id问题
|
2025-07-22 18:36:53 +08:00 |
|
shaw
|
a431778363
|
fix 修复openai格式流式响应的结束标记问题
|
2025-07-22 18:00:24 +08:00 |
|
shaw
|
6150ed4258
|
fix openai兼容格式转发claude固定系统提示词
|
2025-07-22 16:26:17 +08:00 |
|
shaw
|
dabf3bf7ea
|
feat: 实现 Claude Code headers 动态管理功能
- 创建 claudeCodeHeadersService 管理各账号的 Claude Code headers
- 自动捕获成功请求的 headers 并按账号存储在 Redis
- 智能版本管理,只保留最新版本的 headers
- OpenAI 转发时根据账号动态获取对应的 headers
- 添加管理端点查看和清除各账号的 headers 信息
- 完整支持 Claude Code 必需的 beta headers
解决了 "This credential is only authorized for use with Claude Code" 错误
避免了固定版本号带来的风控问题
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-07-22 16:03:31 +08:00 |
|
shaw
|
b2ad2a4a61
|
fix: 修复 OpenAI 兼容路由的 Claude API 认证和 Function Calling 支持
- 添加必需的系统消息 "You are Claude Code, Anthropic's official CLI for Claude."
- 修改 anthropic-beta header 为 OAuth-only 模式 (oauth-2025-04-20)
- 不再传递客户端 headers,使用固定的 4 个必需 headers
- 增强流式响应的 Function Calling 支持,正确处理 tool_use 事件
- 支持自定义 beta header 参数,允许不同路由使用不同的认证模式
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-07-22 14:38:30 +08:00 |
|
shaw
|
6ceed5c3ee
|
fix 修复openai格式转发失败的问题
|
2025-07-22 13:55:14 +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
|
6b0832bc2d
|
fix: 修复 OpenAI 兼容路由中的 router.handle() 错误
- 移除了 openaiClaudeRoutes.js 中错误的 router.handle() 调用
- 提取 handleChatCompletion 函数作为共享处理逻辑
- 修复了 /v1/completions 端点的实现
- 确保 /openai/claude 和 /openai/gemini 路由正常工作
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-07-22 12:58:11 +08:00 |
|
shaw
|
12d68af421
|
update default redirectUri
|
2025-07-22 11:52:07 +08:00 |
|
shaw
|
11318c22b0
|
feat: 优化 Gemini OAuth 授权流程,使用固定的 localhost 回调地址
- 将 Gemini OAuth 回调地址固定为 http://localhost:45462
- 更新前端提示文字为"复制oauth后的链接"
- 实现自动提取 localhost:45462 链接中的 code 参数功能
- 删除不再需要的 web/auth_gemini 路由
- 添加详细的用户操作说明和错误处理提示
- 支持两种输入方式:完整链接或仅授权码
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-07-22 11:42:54 +08:00 |
|
shaw
|
ed99043127
|
fix: 修复 geminiAccountService 配置读取错误并添加 secret scanning 排除规则
- 直接使用硬编码的 Gemini OAuth 凭据,避免配置依赖
- 添加 .github/secret_scanning.yml 排除公开的 OAuth 凭据文件
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-07-22 10:37:43 +08:00 |
|
shaw
|
38c1fc4785
|
feat: 添加多模型支持和OpenAI兼容接口
- 新增 Gemini 模型支持和账户管理功能
- 实现 OpenAI 格式到 Claude/Gemini 的请求转换
- 添加自动 token 刷新服务,支持提前刷新策略
- 增强 Web 管理界面,支持 Gemini 账户管理
- 优化 token 显示,添加掩码功能
- 完善日志记录和错误处理
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-07-22 10:17:39 +08:00 |
|
shaw
|
4f0d8db757
|
fix: 修复总Token消耗USD计算重复统计问题
- 将usage-costs的all模式改为只使用monthly数据,避免daily、monthly、hourly重复计算
- 更新正则表达式只匹配monthly格式的key
- 确保总消耗与模型统计表格的USD计算保持一致
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-07-20 21:36:51 +08:00 |
|
shaw
|
ff554d7c70
|
fix: 修复总Token消耗USD计算与模型统计不一致的问题
- 修正Redis key匹配模式从 'usage:model:*:*' 到 'usage:model:*:*:*'
- 更新正则表达式以支持hourly统计数据
- 确保所有模型都使用正确的价格计算费用
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-07-20 21:18:39 +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
|
4291983c87
|
chore: remove raw sse chunk logging
|
2025-07-20 00:19:00 +08:00 |
|
shaw
|
4bb2050093
|
fix: 修复API Key模型限制功能不生效的问题
- 在apiKeyService.validateApiKey()中添加缺失的enableModelRestriction和restrictedModels字段返回
- 添加详细的调试日志来追踪模型限制检查的执行流程
- 解析存储在Redis中的restrictedModels JSON数据
- 确保模型限制数据正确传递到claudeRelayService
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-07-19 21:13:11 +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
|
f5968e518e
|
feat: 改进管理界面弹窗体验和滚动条美化
- 修复API Key创建/编辑弹窗和账户信息修改弹窗在低高度屏幕上被遮挡的问题
- 为所有弹窗添加自适应高度支持,最大高度限制为90vh
- 美化Claude账户弹窗的滚动条样式,使用紫蓝渐变色与主题保持一致
- 添加响应式适配,移动设备上弹窗高度调整为85vh
- 优化滚动条交互体验,支持悬停和激活状态
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-07-18 23:49:55 +08:00 |
|
shaw
|
6988be0806
|
fix: 修复长上下文请求超时问题
- 设置HTTP服务器超时时间与代理超时时间一致
- 默认超时时间为5分钟(可通过DEFAULT_PROXY_TIMEOUT环境变量配置)
- 同时设置keepAliveTimeout避免连接过早断开
- 解决了Node.js默认2分钟超时导致的长上下文处理中断问题
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-07-18 14:04:51 +08:00 |
|
shaw
|
11873ed78b
|
fix: 统一管理员密码管理机制,以init.json为唯一数据源
- app.js: 每次启动强制从init.json加载管理员凭据到Redis,确保数据一致性
- web.js: 修改密码时先更新init.json,成功后再更新Redis缓存
- cli/index.js: CLI创建管理员时同时更新init.json和Redis
- setup.js: 优化提示信息,明确重置密码需要重启服务
- admin.js: 修复Claude账户专属绑定功能的验证逻辑
解决了之前存在的双重存储同步问题,现在init.json是唯一真实数据源。
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-07-17 20:57:31 +08:00 |
|
shaw
|
ee9bd4aea4
|
feat: 实现Claude账户专属绑定功能
- 添加账户类型(dedicated/shared)支持
- API Key可绑定专属账户,优先使用绑定账户
- 未绑定的API Key继续使用共享池和粘性会话
- 修复专属账户下拉框显示问题(isActive类型不匹配)
- 修复getBoundAccountName方法未定义错误
- 添加删除账户前的API Key绑定检查
- 完全保留原有粘性会话机制
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-07-17 08:50:12 +08:00 |
|
shaw
|
a64ced0e36
|
fix: 修复非流式响应JSON解析错误和max_tokens参数校验
- 修复gzip压缩响应处理:添加zlib模块支持,正确解压缩Claude API响应
- 优化max_tokens验证机制:从硬编码改为动态读取model_pricing.json文件
- 改进错误处理:增强响应数据处理的容错性
- 修复SSE错误事件格式:统一字符串引号风格
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-07-16 18:12:19 +08:00 |
|
shaw
|
8ca9ffee68
|
fix: 改进socket hang up和网络错误处理机制
- 修复socket hang up错误导致返回空字符串的问题
- 改进非流式请求的错误处理,根据错误类型返回适当的HTTP状态码
- 优化流式请求的错误处理,返回SSE格式的错误事件
- 增强错误日志记录,包含详细的网络错误信息
- 确保在任何情况下都返回有效的JSON响应格式
修复内容:
- ECONNRESET错误返回502状态码和明确的错误信息
- ENOTFOUND错误返回502状态码和DNS解析失败信息
- ECONNREFUSED错误返回502状态码和连接被拒绝信息
- ETIMEDOUT错误返回504状态码和超时信息
- 流式请求错误时返回符合SSE规范的错误事件
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-07-16 17:56:29 +08:00 |
|
shaw
|
c16c6b63cf
|
fix: 修复用户菜单显示问题和真实用户名显示
- 修复登录接口返回真实用户名而非输入用户名
- 新增获取当前用户信息的API接口(/web/auth/user)
- 修复前端用户名显示逻辑,页面初始化时获取真实用户名
- 提高下拉菜单z-index确保正确显示
- 解决用户名显示为Admin而非data/init.json中真实用户名的问题
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-07-16 17:26:02 +08:00 |
|
shaw
|
156bfa9b58
|
feat: 添加管理员账户信息修改功能
- 新增右上角用户菜单,包含修改账户信息和退出登录选项
- 实现修改用户名和密码功能,支持独立修改或同时修改
- 添加密码强度验证(最少8位)和确认密码验证
- 修改后自动退出登录,确保安全性
- 同步更新Redis和data/init.json文件,保持数据一致性
- 优化用户体验,提供实时反馈和错误提示
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-07-16 17:16:29 +08:00 |
|