Commit Graph

128 Commits

Author SHA1 Message Date
shaw
d2f0ac37a9 feat: 支持Dark Mode 2025-08-22 22:09:38 +08:00
shaw
4aa562be21 fix: 去除logger自动添加metadata字段 2025-08-20 21:45:48 +08:00
Wesley Liddick
d27c84b13b Merge pull request #262 from mouyong/dev
fix(proxy): 强制 SOCKS5 代理使用 IPv4
2025-08-20 21:43:40 +08:00
mouyong
54dca0f285 fix(frontend): 修复编辑分组模态框显示问题
WHAT: 修复账户分组管理中编辑分组表单无法显示的问题
WHY: 编辑模态框使用无效的 z-60 类名导致层级冲突,编辑表单被主模态框遮挡
HOW: 将编辑模态框的 z-index 类名从 z-60 改为 z-50,与主模态框同级但利用 DOM 顺序确保正确显示;保持其他样式和功能不变
2025-08-20 21:37:19 +08:00
iRubbish
1ee71ffbc9 feat: 完善 API Keys 批量删除功能并修复搜索跨选择问题
## 主要改进

### 🔧 核心修复
- 修复搜索时勾选状态无法保存的问题
- 优化全选/取消全选逻辑,支持跨搜索结果保持选择状态
- 改进批量删除的用户体验
- 添加 Unicode 字符处理中间件,提升请求体解析稳定性

### 🎯 具体变更
- **路由修复**: 解决批量删除路由匹配问题,调整路由顺序
- **API客户端**: 修复 DELETE 方法支持请求体数据传输
- **前端逻辑**: 分离筛选和搜索的监听器,搜索时保持已选中状态
- **全选优化**: 取消全选时只移除当前页选中项,保留其他页面选择
- **Unicode处理**: 添加无效 UTF-16 代理对清理和错误处理机制
- **配置管理**: 将 .mcp.json 添加到 .gitignore,避免本地配置被提交

### 🚀 用户体验提升
- 支持跨搜索结果批量选择和删除
- 批量删除按钮显示选中数量
- 智能的全选状态管理
- 更好的 Unicode 字符处理容错性

### 🧪 测试验证
- 验证搜索切换时选择状态保持
- 确认批量删除功能正常工作
- 检查 Redis 数据清理完整性
- 测试 Unicode 字符处理稳定性

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 09:59:54 +08:00
shaw
b1344fef8c fix: prettier format 2025-08-15 18:47:09 +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
KevinLiao
f1febd320e fix: 去掉Free账号 2025-08-14 16:49:20 +08:00
KevinLiao
0e5f4e03c1 feat: 新增Claude账号订阅类型设置
1. OAuth可自动判断订阅类型,Setup Token请自行选择。无论那种类型都可以自己改
2. 优化调度,Pro账号不再接受opus模型请求的调度
2025-08-14 16:43:58 +08:00
shaw
5428462f55 fix: 修复 OpenAI 账户代理配置保存问题
- 修复 OAuth 方式添加 OpenAI 账户时缺少 priority 字段
- 修复创建 OpenAI 账户时错误检查 proxy.enabled 导致代理未保存
- 添加 OpenAI OAuth token 交换时的 SOCKS5 代理支持
- 添加 OpenAI API 请求转发时的代理支持
- 参考 Claude/Gemini 实现统一代理处理逻辑
2025-08-13 22:44:48 +08:00
Wesley Liddick
ceb1749859 Merge pull request #243 from tanaer/fixed
Fixed: 新增 Claude Console 账户限流机制开关
2025-08-13 17:49:47 +08:00
wt
171d35f33e Fix: Claude Console 账户的限流开关 2025-08-13 10:36:15 +08:00
wt
e338fb0e03 Fix: Claude Console 账户的限流开关 2025-08-13 00:05:03 +08:00
shaw
4ca9674772 feat: 完善多平台账户管理和API Keys页面展示
- 修复OpenAI路由中的gpt-5模型ID处理
- 增强统一调度器的账户选择日志输出
- 优化OAuth流程中的账户类型处理
- 完善API Keys页面的多平台账户信息展示

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-12 17:55:45 +08:00
Wesley Liddick
b250b6ee3b Merge pull request #235 from tanaer/feature
feat: 新增 Claude Console 账户限流机制开关
2025-08-12 16:21:10 +08:00
wt
6dfaf637aa feat: 新增 Claude Console 账户限流机制开关 2025-08-12 15:48:41 +08:00
shaw
b3cba9e091 feat: 完善API Keys页面多平台账户绑定信息展示
- 支持显示Claude、Gemini和OpenAI三个平台的账户绑定信息
- 添加账户状态提醒(不存在、专属、分组、共享池)
- 优化UI设计,使用彩色标签区分不同平台
- 改进响应式布局,适配移动端和平板设备
- 修复OpenAI账户绑定数量统计问题
- 修复删除账户时OpenAI绑定检查逻辑

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-12 15:01:56 +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
千羽
11fc856999 chore: commit all changes 2025-08-10 17:46:31 +09:00
mouyong
4bcd2878f2 feat: 增强账户管理页面的平台筛选和缓存优化功能
- 添加平台筛选功能到账户管理页面
  * 后端:在所有账户接口中支持platform和groupId查询参数
  * 前端:添加平台筛选下拉框,支持条件性API请求

- 使用智能缓存机制优化数据加载
  * 缓存API Keys、账户分组和分组成员数据
  * 通过Ctrl/⌘+点击刷新按钮实现强制重新加载
  * 在数据变更时自动清除相关缓存(创建/编辑/删除)

- 改进Gemini账户限流状态显示
  * 在geminiAccountService中添加限流信息支持
  * 统一所有平台的限流状态格式
  * 修复仪表板统计,排除被限流的账户

- 提升用户界面体验
  * 将原生title提示替换为Element Plus的el-tooltip组件
  * 支持跨平台键盘快捷键(Ctrl/⌘+点击)
  * ESLint规范合规和代码格式化改进

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-10 12:40:24 +08:00
Wesley Liddick
27ca140fc3 Merge pull request #219 from kevinconan/main
fix: 修复Claude Console账号的模型映射功能
2025-08-08 20:39:18 +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
KevinLiao
1ff0824a81 fix: 修复prettier格式化 2025-08-08 15:56:32 +08:00
KevinLiao
33df4bf943 fix: 恢复ClaudeConsole 账号模型映射能力 2025-08-08 15:18:41 +08:00
shaw
7e1a9daa6b feat: 完善管理界面功能和用户体验
- 添加 API Key 窗口倒计时组件 (WindowCountdown)
- 添加自定义下拉菜单组件 (CustomDropdown)
- 优化账户和 API Key 管理界面交互
- 改进教程页面布局和说明文字
- 完善账户状态显示和错误处理

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-08 14:14:46 +08:00
shaw
4adc8d9695 恢复并保存本地修改:仪表盘服务账户分类显示、WindowCountdown组件等功能 2025-08-08 11:56:24 +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
千羽
35e16038a5 feat: add Setup Token OAuth flow for simplified Claude account setup
Introduces a streamlined Setup Token authentication method that reduces the required OAuth scopes from 'org:create_api_key user:profile user:inference' to just 'user:inference', simplifying the account setup process for users who only need inference capabilities.

Key changes:
- Add Setup Token authorization endpoints in admin routes
- Implement Setup Token OAuth flow with PKCE support in oauthHelper
- Update AccountForm to support Setup Token as the default auth method
- Add automatic authorization code extraction from callback URLs
- Maintain full proxy configuration support for Setup Token flow
- Preserve existing OAuth flow for advanced users requiring API key creation

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-07 22:48:48 +09: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
KevinLiao
ae7f4e2405 fix: 修改Claude Console 账号的UA默认行为,默认透传客户端UA而非固定的UA值 2025-08-07 12:33:32 +08:00
shaw
e57b98f343 fix: 修复 API Key 创建和编辑时账户绑定冲突问题
- 创建 API Key 时确保 OAuth 和 Console 账户不会同时设置
- 编辑 API Key 时正确清空未使用的账户类型字段
- 使用共享池时清空所有账户绑定

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-07 00:43:09 +08:00
andersonby
79951920ea fix: update placeholder text in AccountForm.vue to correct model name from hiku to haiku 2025-08-06 20:40:59 +08:00
andersonby
5883a60fba Merge upstream changes and resolve conflicts
- Merged latest changes from Wei-Shaw/claude-relay-service
- Resolved conflict in AccountForm.vue to support both Bedrock and improved platform switching logic
- Maintained Bedrock integration while incorporating Gemini pricing improvements

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-06 19:26:31 +08:00
andersonby
657b7b0a05 feat: Add test scripts for Bedrock models and model mapping functionality 2025-08-06 19:23:36 +08:00
shaw
b1ea32caba feat: 添加Gemini定价功能和界面优化
- 实现Gemini定价查询服务,支持实时计算token成本
- 改进API Key管理界面,添加模型快速选择功能
- 优化账户表单组件的渲染性能
- 更新Gemini账户服务,增强token刷新和错误处理

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-06 18:09:43 +08:00
andersonby
9a9a82c86f feat: Add comprehensive Amazon Bedrock integration support
Add complete Amazon Bedrock integration to Claude Relay Service with:

## Core Features
-  Bedrock account management with encrypted AWS credential storage
-  Full request routing to AWS Bedrock with streaming support
-  Integration with unified Claude scheduler system
-  Support for Inference Profiles and Application Inference Profiles
-  Configurable default and small-fast model settings

## Backend Services
- Add bedrockAccountService.js for account management
- Add bedrockRelayService.js for request forwarding
- Integrate Bedrock accounts into unifiedClaudeScheduler.js
- Update admin and API routes to support Bedrock endpoints
- Add comprehensive configuration options to config.example.js

## Frontend Integration
- Complete Vue.js Web UI for Bedrock account management
- Account creation form with AWS credentials and model configuration
- Real-time account status monitoring and statistics
- Edit/update capabilities for existing accounts

## CLI Support
- Interactive CLI commands for Bedrock account operations
- Account creation, listing, updating, and testing
- Status monitoring and connection validation

## Security & Performance
- AES encrypted storage of AWS credentials in Redis
- Support for temporary credentials (session tokens)
- Region-specific configuration support
- Rate limiting and error handling

This integration enables the relay service to support three AI platforms:
1. Claude (OAuth) - Original Claude.ai integration
2. Gemini - Google AI integration
3. Amazon Bedrock - New AWS Bedrock integration

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-06 17:41:16 +08:00
Wesley Liddick
e9844c4a86 Merge pull request #191 from JinFanZheng/feature/api-key-quick-add-models
feat: add quick add buttons for model restrictions in API Key editor
2025-08-06 10:30:00 +08:00
Yuhan Jian
828a8e1c0d fix: change password 404 error
fix: change password 404 error
2025-08-06 10:22:03 +08:00
Van Zheng
9781a39e09 feat: add quick add buttons for model restrictions in API Key editor
- Add quick add buttons for common Claude models including claude-opus-4-1-20250805
- Implement dynamic filtering to hide models already in restriction list
- Add mobile-responsive design with proper text sizing and layout
- Show helpful message when all common models are restricted

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-06 09:44:26 +08:00
VanZheng
1e61e7a31d feat: add comprehensive Makefile for project management (#1)
* fix: 修复timeRange=7days时的数据加载和显示问题

## 修复内容

### 后端修复 (src/routes/admin.js)
- 添加 /admin/usage-costs 接口对 period=7days 的支持
- 实现7天时间范围的成本统计,汇总最近7天的daily数据
- 修复时区处理不一致导致的数据过滤错误

### 前端修复 (web/admin-spa/src/stores/dashboard.js)
- 修改 loadDashboardData() 支持动态 timeRange 参数
- 根据时间范围动态调整 usage-costs 查询参数
- 消除硬编码的 period=today 和 period=all

### 前端修复 (web/admin-spa/src/views/ApiKeysView.vue)
- 修正API Key详情统计的period计算逻辑
- 7days时间范围现在正确传递 period=daily 而非 monthly
- 确保列表数据和详情统计使用一致的时间范围

## 解决的问题
- 选择"最近7天"时数据显示不准确或缺失
- API Key详情展开时period参数错误
- 成本统计不跟随时间范围选择变化
- 时区计算不一致导致的边界问题

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

Co-Authored-By: Claude <noreply@anthropic.com>

* feat: add comprehensive Makefile for project management

- Add common development commands (install, setup, dev, start)
- Add frontend build commands (build-web, build-all)
- Add service management with daemon support
- Add Docker deployment commands
- Add CLI management tools shortcuts
- Add maintenance and monitoring commands
- Include Chinese descriptions for better UX

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

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-08-06 00:45:28 +08:00
shaw
4ebe6abd96 fix: 修复编辑账户时分组调度选择不生效的问题
- 为 Claude Console 和 Gemini 账户的更新接口添加分组处理逻辑
- 处理账户类型变更时的分组关系(从旧分组移除,添加到新分组)
- 修复前端编辑账户时分组 ID 的初始化问题
- 优化删除账户时自动从分组中移除的逻辑

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-05 19:02:27 +08:00
Wesley Liddick
5b0c02d8ce Merge pull request #181 from wbchn/main
fix: 🐛 修复续期 endpoint
2025-08-05 17:34:41 +08:00
shaw
98a2452698 style: 添加次要按钮样式
添加 btn-secondary 类的渐变背景和悬停效果,提供灰色系的次要按钮样式。

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-05 17:31:12 +08:00
shaw
7fa75df1fd fix: 修复分组调度功能和API Keys统计弹窗UI问题
1. 分组调度功能修复:
   - 统一使用 unifiedClaudeScheduler 和 unifiedGeminiScheduler
   - 修复 schedulable 字段数据类型不一致问题(布尔值/字符串)
   - 添加 _isSchedulable() 辅助方法确保兼容性
   - 修复所有路由文件中的调度器调用

2. API Keys 统计弹窗UI优化:
   - 统一弹窗样式与系统UI风格
   - 添加右上角关闭按钮
   - 修复移动端宽度问题(设置为95%屏幕宽度)
   - 使用 Teleport 组件和项目通用样式

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-05 17:06:52 +08:00
wbchn
e6e5a2d53e fix: 🐛 修复续期 endpoint 2025-08-05 14:19:38 +08:00
mouyong
c36ae32928 Merge branch 'main' of github.com:Wei-Shaw/claude-relay-service
* 'main' of github.com:Wei-Shaw/claude-relay-service:
  chore: sync VERSION file with release v1.1.72 [skip ci]
  fix: 修复账户管理和API Key管理的多个问题
  fix: 修复 GitHub Actions 版本检测对合并提交的处理
2025-08-04 20:34:38 +08:00
mouyong
54ad8452c3 feat: gemini 流式响应 2025-08-04 20:34:17 +08:00
shaw
a69d1ae1dd fix: 修复账户管理和API Key管理的多个问题
- 修复 Claude Console 账号 supportedModels 导致的 be.join 错误
- 添加专属账号选择器组件,支持搜索和按创建时间倒序排序
- 修复搜索框图标与placeholder文字重叠的问题
- 修复选择共享账号池后显示文字不正确的问题
- 优化下拉框定位逻辑,解决超出视窗无法滚动的问题

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-04 18:44:36 +08:00
shaw
ef4f7483d3 feat: 完善 Gemini 功能与 Claude 保持一致
- 添加 Gemini 账户的 schedulable 字段和调度开关 API
- 实现 Gemini 调度器的模型过滤功能
- 完善 Gemini 数据统计,记录 token 使用量
- 修复 Gemini 流式响应的 SSE 解析和 AbortController 支持
- 在教程页面和 README 中添加 Gemini CLI 环境变量说明
- 修复前端 Gemini 账户调度开关限制

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-04 16:53:11 +08:00
shaw
be98d5c498 fix: 修复账户管理页面移动端布局数据显示问题
- 修复移动端数据路径不一致问题(usage.dailyRequests -> usage.daily.requests)
- 增强移动端会话窗口显示,添加进度百分比、时间窗口和剩余时间
- 改进会话窗口UI,使用卡片样式更清晰展示信息
- 检查确认API Keys页面无类似问题

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-04 12:48:15 +08:00