jft0m
b886012f97
Merge branch 'Wei-Shaw:main' into main
2025-10-14 22:39:30 +08:00
jft0m
344599f318
refactor: extract intelligent routing to unified.js
...
- Created new src/routes/unified.js (225 lines)
- detectBackendFromModel(): Detects backend from model name
- routeToBackend(): Routes to Claude/OpenAI/Gemini with permission checks
- POST /v1/chat/completions: OpenAI-compatible endpoint with intelligent routing
- POST /v1/completions: Legacy completions endpoint with intelligent routing
- Updated src/routes/api.js (reduced from 1185 to 968 lines)
- Removed ~217 lines of routing logic
- Kept Claude-specific endpoints (/api/v1/messages)
- Maintained all other Claude API functionality
- Updated src/app.js
- Added unifiedRoutes registration at /api prefix
Benefits:
- Single responsibility: api.js focuses on Claude API routes
- Better organization: routing logic isolated in unified.js
- Easier maintenance: changes to routing won't affect Claude code
- File size reduction: api.js reduced by 18%
Tested:
- ✅ Claude model routing via /v1/chat/completions
- ✅ OpenAI model routing (correct backend detection)
- ✅ Gemini model routing (correct backend detection)
- ✅ Legacy /v1/completions endpoint
- ✅ All tests pass, no regressions
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-10-14 14:30:23 +00:00
jft0m
e540ec3a52
feat: add intelligent backend routing and model service
...
- Add modelService for centralized model management
- Support dynamic model list from config file (data/supported_models.json)
- Include 2025 latest models: GPT-4.1, o3, o4-mini, Gemini 2.5, etc.
- File watcher for hot-reload configuration changes
- Improve model detection logic in api.js
- Priority: modelService lookup → prefix matching fallback
- Smart backend routing based on model provider
- Add intelligent routing endpoints
- /v1/chat/completions: unified OpenAI-compatible endpoint
- /v1/completions: legacy format support
- Auto-route to Claude/OpenAI/Gemini based on requested model
- Add Xcode system prompt support in openaiToClaude
- Detect and preserve Xcode-specific system messages
- Export handler functions for reuse
- openaiClaudeRoutes: export handleChatCompletion
- openaiRoutes: export handleResponses
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-10-14 14:12:44 +00:00
github-actions[bot]
b4658e5d5f
chore: sync VERSION file with release v1.1.175 [skip ci]
2025-10-14 06:34:22 +00:00
Wesley Liddick
4b3ffa4136
Merge pull request #561 from AAEE86/new
...
feat: 添加Droid账户API Key管理功能
2025-10-14 14:34:07 +08:00
github-actions[bot]
86ccb0273e
chore: sync VERSION file with release v1.1.174 [skip ci]
2025-10-14 06:24:00 +00:00
shaw
dfea5fe534
docs: 更新gemini配置教程
2025-10-14 11:40:07 +08:00
shaw
914142541a
Revert "fix: 修复账户到期时间的时区偏差问题"
...
This reverts commit 46ba514801 .
2025-10-14 11:29:33 +08:00
shaw
d6a9beff2f
feat: 适配新版本gemini
2025-10-14 11:24:27 +08:00
AAEE86
8dd07919f4
fix: 修复 API Key 管理界面按钮的点击事件逻辑
2025-10-14 10:34:38 +08:00
AAEE86
582348d615
fix: 修正删除API Key时更新数据的字段名称
2025-10-14 10:09:47 +08:00
AAEE86
38c61e1018
refactor: 优化API Key状态过滤逻辑,增强代码可读性
2025-10-14 09:37:46 +08:00
AAEE86
8d84e2fa6e
refactor: 优化API Key状态更新和日志记录格式
2025-10-14 09:33:17 +08:00
AAEE86
e051ade27e
feat: 按最新使用时间排序API Keys
2025-10-14 01:05:22 +08:00
AAEE86
ea3ad2157f
fix: 优化API Key错误状态码的显示方式
2025-10-14 00:53:19 +08:00
DokiDoki1103
46ba514801
fix: 修复账户到期时间的时区偏差问题
...
修复了在编辑账户到期时间时,保存后显示时间相差8小时的问题。
问题原因:
- datetime-local 输入框的值使用 new Date(string) 解析时
- 部分浏览器会错误地将其解释为 UTC 时间
- 导致保存和显示时出现时区转换不一致
解决方案:
- 手动解析日期时间字符串的各个部分
- 使用 Date 构造函数明确创建本地时间对象
- 然后统一转换为 UTC ISO 字符串存储
- 确保时区转换的一致性
修改文件:
- web/admin-spa/src/components/accounts/AccountExpiryEditModal.vue
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-10-13 19:04:11 +08:00
AAEE86
1f9afc788b
feat: 添加Droid账户API Key管理功能
...
(cherry picked from commit 0cf3ca6c7eafcf28a2da7e8bfd6814b4883bb752)
2025-10-13 18:24:49 +08:00
github-actions[bot]
268f041588
chore: sync VERSION file with release v1.1.173 [skip ci]
2025-10-13 03:41:53 +00:00
Wesley Liddick
222b2862cc
Merge pull request #560 from looksgood/main
...
优化Claude OAuth 账户的模型检查
2025-10-13 11:41:39 +08:00
Wesley Liddick
8ddb905213
Merge pull request #557 from bottotl/main [skip ci]
...
feat: 改善登录表单的可访问性和自动填充支持
2025-10-13 11:36:42 +08:00
jft0m
96eca07ff2
Merge branch 'Wei-Shaw:main' into main
2025-10-13 11:32:02 +08:00
Wesley Liddick
2215b0acd8
Merge pull request #555 from DokiDoki1103/fix/ccr-account-modal-dark-theme [skip ci]
...
fix: 修复 CCR 账户弹窗暗黑主题失效问题
2025-10-13 11:25:33 +08:00
shaw
43dee194f4
chore: 移除github参数 [skip-ci]
2025-10-13 11:23:32 +08:00
shaw
3ab2c0ec20
docs: README 移除claude code使用droid api相关文档
2025-10-13 11:18:57 +08:00
liangjie.wanglj
8093dfb11c
优化Claude OAuth 账户的模型检查
2025-10-13 10:55:19 +08:00
shaw
f302c94d3c
docs: 移除claude code使用droid api相关文档
2025-10-13 10:51:06 +08:00
shaw
1145fb7b7d
fix: 修复apikey的并发控制问题
2025-10-13 09:48:13 +08:00
shaw
cea6f976b9
fix: 修复批量编辑模式下专属账号修改的问题
2025-10-13 09:16:13 +08:00
shaw
508d9aad1b
fix: 继续修复PR-541引发的系列bug
2025-10-13 08:41:24 +08:00
shaw
a67c34bee1
fix: 修复claude SSE捕获usage问题
2025-10-12 23:05:48 +08:00
jft0m
44a7a61f14
Merge branch 'Wei-Shaw:main' into main
2025-10-12 22:51:22 +08:00
jft0m
ad64bd3c51
feat: 改善登录表单的可访问性和自动填充支持
...
- 为所有表单字段添加 id 和 name 属性
- 添加 autocomplete 属性支持浏览器自动填充
- 使用 for 属性正确关联 label 和 input
- 优化代码格式符合 Prettier 规范
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-10-12 14:50:07 +00:00
shaw
6f6c274877
fix: 继续修复PR-541遗留的系列bug
2025-10-12 22:13:38 +08:00
github-actions[bot]
7d4bf9f94f
chore: sync VERSION file with release v1.1.172 [skip ci]
2025-10-12 13:04:02 +00:00
shaw
692abbc4f8
Merge branch 'fix/remove-horizontal-scrollbar-accounts-page' into dev
2025-10-12 21:00:24 +08:00
DokiDoki1103
a2844e802a
fix: 修复 CCR 账户弹窗暗黑主题失效问题
...
- 为全局 modal 和 modal-content 添加暗黑模式样式
- 在 CcrAccountForm 组件中使用 Tailwind 暗黑模式类替代 scoped style
- 优化关闭按钮在暗黑模式下的显示效果
此修复确保 CCR 账户添加/编辑弹窗在暗黑模式下正确显示深色背景和样式,与其他界面元素保持一致的用户体验。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-10-12 20:59:41 +08:00
shaw
5611e86154
fix: 修复console计费问题
2025-10-12 20:56:27 +08:00
DokiDoki1103
e6d9a46b98
fix: 移除账户管理页面的横向滚动条
...
- 移除 .table-container 的 overflow-x: auto 样式
- 清理重复的样式定义
- 修复账户管理页面在某些情况下出现不必要横向滚动条的问题
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-10-12 20:49:00 +08:00
shaw
22928aeae3
fix: 优化droid默认启用推理的问题
2025-10-12 20:16:13 +08:00
shaw
2fa1b0b1dc
fix: 优化创建apikey成功弹窗
2025-10-12 19:59:01 +08:00
shaw
33e69ac6e2
fix: 修复droid claude的temperature参数问题
2025-10-12 19:14:25 +08:00
github-actions[bot]
0b00682e74
chore: sync VERSION file with release v1.1.171 [skip ci]
2025-10-12 10:36:15 +00:00
shaw
45dab2af40
fix: 修复temperature参数传递问题
2025-10-12 18:35:28 +08:00
shaw
40b7c68694
fix: 修复账号过期时间的一系列bug
2025-10-12 18:35:05 +08:00
github-actions[bot]
f513be4328
chore: sync VERSION file with release v1.1.170 [skip ci]
2025-10-12 06:11:52 +00:00
shaw
a3dacbccd0
refactor: 编辑账户时隐藏过期时间表单,使用独立编辑弹窗
...
## 问题分析
编辑账户时显示过期时间表单存在以下问题:
1. **相对时间 vs 绝对时间冲突**:
- 下拉框提供相对时间选项(30天、90天等)
- 实际存储的是绝对时间(如 2025-02-15)
- 过了1天后,无法准确对应原来的"30天"选项
2. **用户体验混乱**:
- 设置了30天过期,编辑时下拉框显示"永不过期"
- 无法准确回显用户当初的选择
- 容易误导用户
3. **功能重复**:
- 已有独立的AccountExpiryEditModal弹窗专门编辑过期时间
- 该弹窗使用绝对时间显示,更清晰准确
## 解决方案
仅在编辑模式下隐藏过期时间表单:
- 创建账户时:保留过期时间表单(相对时间设置合理)
- 编辑账户时:隐藏过期时间表单,引导用户使用独立的编辑弹窗
## 实现细节
在两处过期时间表单添加 v-if="!isEdit" 条件:
- 第645行:OAuth添加方式的表单
- 第2116行:手动添加方式的表单
## 用户流程改进
- 创建账户:可以快速选择相对过期时间(30天、90天等)
- 编辑账户:在列表中点击"编辑到期时间"按钮 → 使用独立弹窗编辑
- 弹窗优势:显示当前绝对过期时间、支持快捷延期、实时预览新时间
文件: web/admin-spa/src/components/accounts/AccountForm.vue:645,2116
2025-10-12 14:04:16 +08:00
shaw
62e457932e
fix: 修复账户编辑时过期时间不回显的问题
...
## 问题描述
在账户编辑页面,虽然过期时间已保存并在列表中正确显示,但点击编辑时:
- expireDuration 和 customExpireDate 字段为空
- 导致过期时间选择器显示为空白状态
## 根本原因
AccountForm.vue 的 form 初始化时:
- expiresAt 正确读取了 props.account?.expiresAt
- 但 expireDuration 和 customExpireDate 都初始化为空字符串
- 缺少从 expiresAt 反向初始化这两个字段的逻辑
## 修复方案
修改 form 初始化逻辑(第 3443-3457 行):
- expireDuration: 如果存在 expiresAt,设置为 'custom'
- customExpireDate: 如果存在 expiresAt,转换为 datetime-local 格式 (YYYY-MM-DDTHH:mm)
- expiresAt: 保持原有逻辑不变
## 技术细节
使用 IIFE (立即执行函数) 在 reactive 对象初始化时计算初始值:
```javascript
expireDuration: (() => {
if (props.account?.expiresAt) return 'custom'
return ''
})()
```
## 测试验证
- ✅ 编辑已设置过期时间的账户,过期时间正确回显
- ✅ 编辑未设置过期时间的账户,显示为永不过期
- ✅ AccountExpiryEditModal 组件已有正确的初始化逻辑,无需修改
文件: web/admin-spa/src/components/accounts/AccountForm.vue:3443-3457
2025-10-12 13:56:26 +08:00
shaw
0d7a200505
Merge PR #512 : 添加 OpenAI chat/completions 兼容支持
...
## 主要功能
- ✅ 使用策略模式处理不同后端(Claude/OpenAI/Gemini)
- ✅ 添加 OpenAI chat/completions 兼容支持
- ✅ 修复代码缩进符合 ESLint 规范
## 核心变更
### 1. 后端检测机制
添加 `detectBackendFromModel()` 函数:
- 根据模型名称前缀检测后端(claude-/gpt-/gemini-)
- 默认使用 Claude 后端
### 2. 扩展模型列表
/v1/models 端点现在返回:
- Claude 模型:Sonnet 4.5, Opus 4.1, Sonnet 4, Haiku等
- OpenAI 模型:gpt-4o, gpt-4o-mini, gpt-4-turbo等
- Gemini 模型:gemini-1.5-pro, gemini-1.5-flash等
### 3. OpenAI 兼容支持
- 添加 `validateChatCompletionRequest()` 验证函数
- 支持 OpenAI chat/completions 请求格式
- 实现流式和非流式响应处理
### 4. 代码规范
- 修复 ESLint 缩进问题
- 统一代码格式
## 技术细节
- 修改文件:src/routes/api.js, src/services/openaiToClaude.js 等
- 版本更新:1.1.168 → 1.1.169
- 保留了之前添加的账户过期检查逻辑(来自PR #541)
作者: bottotl
PR: https://github.com/Wei-Shaw/claude-relay-service/pull/512
2025-10-12 13:49:20 +08:00
shaw
a84f344df6
Merge PR #541 : 添加账户订阅到期时间管理功能 + 修复核心过期检查逻辑
...
## 原PR功能
- ✅ 后端添加subscriptionExpiresAt字段支持
- ✅ 前端提供到期时间设置界面(快捷选项 + 自定义日期)
- ✅ 账户列表显示到期状态(已过期🔴 /即将过期🟠 /永不过期⚪ )
- ✅ 新增AccountExpiryEditModal.vue编辑弹窗组件
- ✅ 支持创建和更新账户时设置到期时间
- ✅ 完整支持暗黑模式
## 🔧 关键修复(本次提交)
原PR缺少核心过期检查逻辑,过期账户仍会被调度使用。本次合并时添加了:
1. **新增isAccountNotExpired()方法**:
- 检查账户subscriptionExpiresAt字段
- 未设置过期时间视为永不过期
- 添加debug日志记录过期账户
2. **在selectAvailableAccount()中添加过期检查**:
- 过滤逻辑中集成this.isAccountNotExpired(account)
- 确保过期账户不被选择
3. **在selectAccountForApiKey()中添加过期检查**:
- 绑定账户检查中添加过期验证
- 共享池过滤中添加过期验证
## 🗑️ 清理工作
- 移除了不应提交的account_expire_feature.md评审文档(756行)
## 技术细节
- API层使用expiresAt,存储层使用subscriptionExpiresAt
- 存储格式:ISO 8601 (UTC)
- 空值表示:null表示永不过期
- 时区处理:后端UTC,前端自动转换本地时区
作者: mrlitong (原PR) + Claude Code (修复)
PR: https://github.com/Wei-Shaw/claude-relay-service/pull/541
2025-10-12 13:42:57 +08:00
shaw
8e415f8ff8
Merge PR #545 : 常用模型增加deepseek-chat;修复修改时默认选择白名单
...
- Claude Console类型账户默认白名单模型增加deepseek-chat模型
- 修复白名单模式下的初始化逻辑:
* 白名单模式:正确设置allowedModels用于显示勾选的模型
* 同时保留modelMappings以便用户切换到映射模式时有初始数据
* 映射模式:只设置modelMappings,不填充allowedModels
- 增加代码注释,清晰说明不同模式的数据设置逻辑
作者: looksgood
PR: https://github.com/Wei-Shaw/claude-relay-service/pull/545
2025-10-12 13:34:10 +08:00