Commit Graph

405 Commits

Author SHA1 Message Date
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
shaw
fce6d8e1ac fix: 修复仪表盘和API统计页面的多个问题
- 修复仪表盘天粒度下7天/30天快捷选择无数据的问题
- 修复API Keys页面统计按钮链接路由错误(admin -> admin-next)
- 改进统计页面限制展示,使用3个进度条更直观显示使用情况
- 后端API响应增加当前使用量数据(currentWindowRequests/Tokens/DailyCost)
- 修复教程页面window.location.origin为空的兼容性问题
- 无限制时使用无穷符号(∞)展示,提升用户体验

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-04 11:58:26 +08:00
shaw
4e3c826b6c fix: 修复API Keys页面时间窗口进度条和Token数值显示问题
- 修复时间窗口限制的请求次数和Token使用量进度条不更新的问题
  - 在apiKeyService.getAllApiKeys()中添加获取当前窗口统计数据的逻辑
  - 从Redis读取rate_limit:requests和rate_limit:tokens键的值

- 优化Token数值展示,添加K/M单位格式化
  - UsageDetailModal组件中5处Token数值改用formatTokenCount
  - ApiKeysView模型统计中5处Token数值改用formatTokenCount
  - 统一使用K/M单位简化大数字显示

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-04 10:55:17 +08:00
shaw
2ceac331dd feat: 优化 API Keys 页面的分组显示和使用统计展示
- 修复分组调度显示,正确展示分组名称
- 重新设计使用统计列,添加进度条显示每日费用和窗口限制
- 创建使用详情弹窗组件,展示完整统计信息
- 优化时间窗口限制显示,支持请求次数和Token双维度进度条
- 改进移动端自适应布局
- 修复 ESLint 警告,提升代码质量

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-04 10:31:59 +08:00
shaw
9ef18a72bd chore: 停止跟踪 web/admin-spa/dist/ 构建文件
- 从 git 中移除 dist 目录的跟踪
- 这些文件由 GitHub Actions 自动构建生成
- 避免本地构建和远程构建之间的冲突

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-04 08:57:19 +08:00
千羽
a80b36896d feat: 更新 Gemini OAuth 流程支持新的授权方式
- 使用 codeassist.google.com 作为新的回调地址
- 实现 PKCE 认证流程增强安全性
- 更新前端授权流程指引
- 简化授权码输入流程

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-04 00:16:29 +08:00
github-actions[bot]
5378cb8910 chore: sync VERSION file with release v1.1.65 and rebuild frontend [skip ci] 2025-08-03 14:49:11 +00:00
shaw
dcf175b366 fix: 修复 web/admin-spa 合并冲突和构建错误
- 恢复 web/admin-spa 目录到 dev 分支状态
- 修复 ApiKeysView.vue 中的重复变量声明问题
- 重新构建前端项目确保正常运行

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-03 22:48:20 +08:00
shaw
a5c7eeaf84 fix: 修复专属账号下拉框,仅显示dedicated类型账号
- 修改CreateApiKeyModal和EditApiKeyModal的过滤逻辑
- 专属账号下拉框只显示accountType='dedicated'的账号
- 移除accountType='group'的账号,这些账号通过分组调度
- 更新标签文字为'专属账号'以更准确描述
2025-08-03 22:34:44 +08:00
shaw
9c9afe1528 feat: 实现账户分组管理功能和优化响应式设计
主要更新:
- 实现账户分组管理功能,支持创建、编辑、删除分组
- 支持将账户添加到分组进行统一调度
- 优化 API Keys 页面响应式设计,解决操作栏被隐藏的问题
- 优化账户管理页面布局,合并平台/类型列,改进操作按钮布局
- 修复代理信息显示溢出问题
- 改进表格列宽分配,充分利用屏幕空间

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-03 22:34:43 +08:00
shaw
329904ba72 fix: 修复仪表盘页面时间筛选功能
- 修复模型使用分布和详细统计数据不响应时间筛选的问题
- 后端/admin/model-stats端点添加startDate和endDate参数支持
- 支持自定义时间范围的模型统计数据聚合
- 前端loadModelStats函数添加时间范围参数传递
- 修复小时粒度和自定义时间筛选不生效的问题

现在时间筛选可以正确控制所有数据展示:
- Token使用趋势图 ✓
- 模型使用分布 ✓
- 详细统计数据 ✓
- API Keys使用趋势 ✓

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-03 22:34:42 +08:00
shaw
495c458e9a fix: 修复API Keys页面的undefined错误
- 修复filteredAndSortedApiKeys未定义错误,改为使用sortedApiKeys
- 添加缺失的分页相关变量定义(currentPage, pageSize, totalPages等)
- 添加paginatedApiKeys计算属性实现分页功能
- 修复CreateApiKeyModal和EditApiKeyModal中localAccounts防御性编程
- 添加筛选条件变化时重置页码的逻辑
- 修复"Cannot read properties of undefined (reading 'length')"错误

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-03 22:34:42 +08:00
shaw
6dd8d0076e fix: 解决Git合并冲突
- 解决ApiKeysView.vue中的合并冲突
- 解决CreateApiKeyModal.vue中的合并冲突
- 解决EditApiKeyModal.vue中的合并冲突
- 保留本地修改版本,包含更完善的功能:
  - Claude OAuth和Console账户分组显示
  - 移动端响应式优化
  - 批量创建API Key功能

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-03 22:34:41 +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
github-actions[bot]
aef39b10d9 chore: sync VERSION file with release v1.1.61 and rebuild frontend [skip ci] 2025-07-31 03:28:28 +00:00
Wesley Liddick
d04bbfec8b Merge pull request #149 from Alfonsxh/feature/api-keys-pagination
fix: 修复 API Key 统计页面链接指向错误的问题
2025-07-31 11:27:55 +08:00
Alfonsxh
1a620ba0fa fix: 修复 API Key 统计页面链接指向错误的问题
- 将统计页面 URL 从 /admin/api-stats 修正为 /admin-next/api-stats
- 确保链接指向正确的 SPA 路由

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-31 11:23:28 +08:00
github-actions[bot]
ca61807906 chore: sync VERSION file with release v1.1.60 and rebuild frontend [skip ci] 2025-07-31 02:54:24 +00:00
Alfonsxh
fb23f09723 feat: 添加 API Keys 管理界面分页功能
- 实现表格分页显示,默认每页显示 10 条记录
- 添加每页数量选择器,支持 5/10/20/50/100 条选项
- 实现智能页码导航,包含上一页、下一页和页码按钮
- 优化界面样式,统一下拉框和按钮的视觉效果
- 筛选或排序时自动重置到第一页
- 显示总记录数统计信息

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-31 10:49:20 +08:00
github-actions[bot]
0d98467688 chore: sync VERSION file with release v1.1.58 and rebuild frontend [skip ci] 2025-07-30 16:19:43 +00:00
KevinLiao
3c797a85e0 feat: Claude Console账号增强,升级模型支持列表为模型映射表! 2025-07-30 23:13:59 +08:00
github-actions[bot]
acf8dbb970 chore: sync VERSION file with release v1.1.57 and rebuild frontend [skip ci] 2025-07-30 12:51:30 +00:00
KevinLiao
6216433b0b Merge branch 'main' of https://github.com/Wei-Shaw/claude-relay-service
# Conflicts:
#	web/admin-spa/dist/assets/LoginView-BJ0LLv16.js
#	web/admin-spa/dist/assets/LogoTitle-DHj-MjwS.js
#	web/admin-spa/dist/assets/MainLayout-CLydIeqJ.js
#	web/admin-spa/dist/assets/SettingsView-DicW12bL.js
#	web/admin-spa/dist/assets/index-HYE9xPuR.js
#	web/admin-spa/dist/index.html
#	web/admin-spa/src/components/apikeys/CreateApiKeyModal.vue
#	web/admin-spa/src/components/apikeys/EditApiKeyModal.vue
#	web/admin-spa/src/views/ApiKeysView.vue
2025-07-30 20:41:10 +08:00
KevinLiao
b86adcd6d2 fix: 1.修复ClaudeConsole账号设置为专属绑定的功能
2. 修复Claude 官方账号会话窗口计算错误的问题
2025-07-30 20:20:12 +08:00