Commit Graph

51 Commits

Author SHA1 Message Date
shaw
2fc84a6aca feat: 新增Droid cli支持 2025-10-09 23:05:09 +08:00
sususu98
57e75cd526 fix: 用户登录接口在开发环境 404 错误
修复 user.js 中未使用 API_PREFIX 导致的路径问题。
  现在开发环境正确使用 /webapi 前缀进行代理转发。
2025-10-03 22:34:31 +08:00
duyaoguang
7fd5224e0a fix: 🐛 fee calc fix 2025-10-02 13:09:19 +08:00
shaw
ea28222c71 feat: 支持账号维度的数据统计 2025-09-27 22:55:06 +08:00
shaw
f9c397cc1f feat: api-stats页面增加周限总限查询 2025-09-21 14:22:34 +08:00
shaw
9c4dc714f8 Revert "Merge pull request #424 from Wangnov/feat/i18n"
This reverts commit 1d915d8327, reversing
changes made to 009f7c84f6.
2025-09-12 09:21:53 +08:00
Wangnov
e36bacfd6b feat: 完成多个组件的国际化支持与文本替换
- 更新 AccountForm.vue 中的占位符文本为 i18n 语言包中的键
- 修改 ConfirmModal.vue 中的确认和取消按钮文本为 i18n 语言包中的键
- 更新 CustomDropdown.vue 中的占位符文本为 i18n 语言包中的键
- 修改 app.js 中的应用标题为英文版本
- 更新 router/index.js 中的日志输出为英文
- 在 accounts.js 和 apiKeys.js 中的错误处理信息中引入 i18n 键以提升多语言一致性
- 更新 dashboard.js 中的系统状态和错误日志为 i18n 键
- 在 DashboardView.vue 中的多个文本替换为 i18n 语言包中的键
2025-09-12 00:04:11 +08:00
Wangnov
d5b9f809b0 feat: 完成布局/仪表板/用户相关组件国际化与语言切换优化(TabBar/MainLayout/AppHeader、UsageTrend/ModelDistribution、User*、Common 组件、i18n/locale 增强) 2025-09-12 00:04:10 +08:00
Wangnov
022724336b feat: Element Plus 语言随 i18n 切换;用户侧登录/禁用提示接入 i18n 2025-09-12 00:03:05 +08:00
Wangnov
482eb7c8f7 feat: 统一 stores(apiKeys/accounts) 错误回退为 i18n 键,提升多语言一致性 2025-09-12 00:03:05 +08:00
Wangnov
01eadea10b feat: stores 部分接入 i18n(auth/settings/apistats/dashboard/clients:标题、错误与日期提示本地化) 2025-09-12 00:03:05 +08:00
Wangnov
cb1b7bc0e3 feat: 实现i18n核心配置和语言状态管理
- 创建i18n配置系统,支持简体中文/繁体中文/英文三种语言
- 实现浏览器语言自动检测和localStorage持久化
- 添加基础翻译文件,包含common、language、header、apiStats模块
- 创建locale store使用Pinia管理语言状态
- 配置语言标识符为纯文字:简/繁/EN,去除国旗emoji
2025-09-12 00:03:01 +08:00
shaw
08946c67ea feat: 新增 OpenAI-Responses 账户管理功能和独立自动停止标记机制
## 功能新增
- 实现 OpenAI-Responses 账户服务(openaiResponsesAccountService.js)
  - 支持使用账户内置 API Key 进行请求转发
  - 实现每日额度管理和重置机制
  - 支持代理配置和优先级设置
- 实现 OpenAI-Responses 中继服务(openaiResponsesRelayService.js)
  - 处理请求转发和响应流处理
  - 自动记录使用统计信息
  - 支持流式和非流式响应
- 新增管理界面的 OpenAI-Responses 账户管理功能
  - 完整的 CRUD 操作支持
  - 实时额度监控和状态管理
  - 支持手动重置限流和每日额度

## 架构改进
- 引入独立的自动停止标记机制,区分不同原因的自动停止
  - rateLimitAutoStopped: 限流自动停止
  - fiveHourAutoStopped: 5小时限制自动停止
  - tempErrorAutoStopped: 临时错误自动停止
  - quotaAutoStopped: 额度耗尽自动停止
- 修复手动修改调度状态时自动恢复的问题
- 统一清理逻辑,防止状态冲突

## 其他优化
- getAccountUsageStats 支持不同账户类型参数
- 统一调度器支持 OpenAI-Responses 账户类型
- WebHook 通知增强,支持新账户类型的事件

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-10 15:41:52 +08:00
shaw
f284d5666f feat: 支持隐藏后台登录入口按钮 2025-09-08 12:19:14 +08:00
shaw
da0ffa07ec fix: 修复apikeys聚合查询统计问题 2025-09-02 23:54:37 +08:00
shaw
886ec35edc feat: api-stats页面支持多key查询 2025-09-02 23:18:31 +08:00
Feng Yue
d5f5e0f4dd Merge branch 'main' into um-5 2025-08-25 17:19:24 +08:00
shaw
74bcb99142 feat: 新增支持Azure OpenAI账户 2025-08-23 10:30:29 +08:00
shaw
d2f0ac37a9 feat: 支持Dark Mode 2025-08-22 22:09:38 +08:00
Feng Yue
71ce1e33b7 fix: API key limit now only counts active keys and uses config value
- Modified API key limit to count only active (non-deleted) keys instead of all keys
- Fixed frontend to use MAX_API_KEYS_PER_USER environment variable instead of hardcoded value
- Added activeApiKeysCount computed property to filter deleted keys
- Updated user profile endpoint to include maxApiKeysPerUser config
- Enhanced user store to persist and retrieve config values

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-15 13:36:05 +08:00
Feng Yue
4509f303e6 feat: enhance user API keys view and fix admin cost display
- Add deleted API keys display to user's My API Keys view
- Show deleted status with gray indicator and "Deleted" badge
- Display deletion date and hide delete button for deleted keys
- Fix cost calculation in admin deleted API keys tab
- Add getCostStats call to properly populate cost data
- Support includeDeleted parameter in user API keys endpoint

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-14 15:25:22 +08:00
Feng Yue
5d850a7c1c chore: remove regenerate api key functionality 2025-08-14 11:59:42 +08:00
Feng Yue
bb60df8b41 chore: redirect back to login page for deactivated users 2025-08-14 11:38:08 +08:00
Feng Yue
56e4630827 fix: lint errors again 2025-08-14 11:37:01 +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
千羽
11fc856999 chore: commit all changes 2025-08-10 17:46:31 +09:00
shaw
4adc8d9695 恢复并保存本地修改:仪表盘服务账户分类显示、WindowCountdown组件等功能 2025-08-08 11:56:24 +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
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
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
wbchn
e6e5a2d53e fix: 🐛 修复续期 endpoint 2025-08-05 14:19:38 +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
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
a6ab6b7abe feat: 实现基于滑动窗口的实时RPM/TPM统计
- 添加系统级分钟统计,支持1-60分钟可配置时间窗口
- 新增 getRealtimeSystemMetrics 方法计算滑动窗口内的平均值
- 前端显示实时RPM/TPM,标注时间窗口和数据来源
- 修复 EditApiKeyModal 中模型限制和客户端限制复选框状态错误
- 优化性能:使用Pipeline批量操作替代Promise.all
- TPM包含所有token类型:input、output、cache_creation、cache_read
- 添加降级方案:实时数据不可用时返回历史平均值

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-30 15:37:57 +08:00
shaw
9a346a22d0 Merge branch 'dev' into main
合并dev分支的时区修复和其他改进:
- 修复仪表板图表时区处理问题
- 修复自定义时间选择器的UTC转换
- 删除dist构建产物目录
2025-07-30 12:50:20 +08:00
shaw
81917c281e fix(admin-spa): 彻底修复时区计算和显示问题
- 修复 getSystemTimezoneDay 函数:正确计算UTC+8时区对应的UTC时间
- 修复时间筛选框显示:昨天/前天显示正确的系统时区日期
- 修复自定义时间范围:正确处理系统时区到UTC的转换
- 简化时区计算逻辑,避免复杂的条件判断
2025-07-30 12:38:08 +08:00
shaw
9d8d698238 fix(admin-spa): 修复时区计算问题 - 使用固定的UTC+8时区
- 修复 getSystemTimezoneDay:正确计算UTC+8时区的起止时间
- 修复自定义时间转换:使用固定的UTC+8时区偏移
- 解决了时区数据未初始化导致的计算错误
2025-07-30 12:25:51 +08:00
shaw
3188f4d058 fix(admin-spa): 修复时区转换计算错误
- 修复 getSystemTimezoneDay 函数:正确使用 Date.UTC 创建UTC时间,避免本地时区干扰
- 修复自定义时间范围转换:使用 Date.UTC 正确转换系统时区时间到UTC
- 解决了昨天/前天日期计算错误的问题
- 解决了自定义时间选择器8小时偏差的问题
2025-07-30 12:13:53 +08:00
shaw
4eedc2e6b5 fix(admin-spa): 修复仪表板时区处理 - 前端显示系统时区,发送UTC时间
- 简化 getSystemTimezoneDay 函数,正确处理系统时区到UTC的转换
- 修复 setDateFilterPreset 中昨天/前天的计算逻辑,使用本地时间计算日期
- 确保自定义时间选择器显示系统时区时间,但发送UTC时间给后端
- API Keys页面已经使用正确的时间范围参数,无需修改
2025-07-30 12:05:30 +08:00
Alfonsxh
fc5c24e1ca feat: 增强 API Key 标签选择功能
- 添加获取已存在标签的 API 端点 /admin/api-keys/tags
- 重构标签输入 UI,从下拉菜单改为平铺展示
- 支持点击选择已有标签,避免重复创建
- 增加弹框宽度 (max-w-4xl),改善布局和用户体验
- 统一创建和编辑 API Key 的标签管理体验

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-30 11:24:27 +08:00
shaw
6eae292922 fix(admin-spa): 修正时区计算双重偏移问题
- 重写getSystemTimezoneDay函数,修复之前的双重偏移错误
- 简化时间计算逻辑,直接使用Date.UTC创建系统时区时间
- 移除不必要的getDateInSystemTimezone调用

问题原因:
之前的实现在计算系统时区日期时进行了双重偏移,导致时间范围错误

修复后:
- 正确计算系统时区某一天的起止UTC时间
- "昨天"选项现在正确显示系统时区的完整一天(如29号0:00到29号23:59)
- 适配所有时区的用户,不依赖用户浏览器时区

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-30 11:01:51 +08:00
shaw
a265ebf335 fix(admin-spa): 修复仪表板图表时区处理问题
- 修复前端时间计算逻辑,正确处理不同时区用户的时间范围选择
- 添加系统时区信息到dashboard API响应
- 修改getSystemTimezoneDay函数,确保正确处理系统时区的日期转换
- 修复"昨天"和"前天"时间范围计算,基于系统时区而非用户时区
- 添加后端调试日志以便追踪时间转换问题

问题描述:
- 选择"昨天"时显示29号7:00到30号6:00(错误)
- 选择"近24小时"时显示29号17:00到30号17:00(错误)

修复后:
- "昨天"正确显示完整一天(如29号0:00到29号23:59)
- "近24小时"正确显示从当前时间往前24小时
- 支持所有时区的用户,不再硬编码UTC+8偏移

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-30 10:52:26 +08:00
shaw
496569d110 修复仪表板折线图时间范围计算错误(UTC+8时区) 2025-07-30 10:34:20 +08:00
shaw
d2ac3961e8 Merge remote-tracking branch 'origin/main' into main 2025-07-30 10:17:25 +08:00
shaw
61b1a0ec32 fix(admin-spa): 修复时区问题导致的图表时间显示不一致和今日统计错误 2025-07-30 09:18:55 +08:00
shaw
53d6f77753 fix(admin-spa): 修复使用趋势图表按小时粒度不显示数据的问题 2025-07-30 08:55:07 +08:00
KevinLiao
fddd5ee3e9 feat: 新增标准Claude Console API账号支持 2025-07-30 08:19:44 +08:00
shaw
9e693d3d7f fix(admin-spa): 修复多个管理后台问题
- 修复代理设置导致页面卡死的问题(循环更新)
- 修复Gemini账号授权码自动提取功能
- 修复账户名称验证无错误提示的问题
- 修复网站图标只在settings页面显示的问题
- 修复删除账户使用自定义确认弹窗
- 修复账号添加成功提示重复显示的问题
- 修复代理配置字段格式与原版不一致的问题
- 添加.gitignore忽略旧版web/admin和web/apiStats目录

所有问题已按照原版逻辑完整修复,提升了用户体验。
2025-07-29 15:11:35 +08:00
shaw
7b81106949 feat: 将admin-spa构建迁移到GitHub Actions workflow
🔄 主要改进:
- 在自动发布流程中添加admin-spa前端构建步骤
- 仅在web/admin-spa目录有改动时才触发构建
- 构建后的dist目录会自动包含在版本发布中
- 移除手动提交的dist目录,避免安全风险

🐛 修复:
- 修复登录后用户名显示为默认"Admin"的问题
- 现在会正确从服务器获取并显示实际用户名

🔒 安全优化:
- 防止恶意代码通过dist目录注入
- 所有前端代码都会在CI环境中重新构建

现在开发者无需手动构建前端,workflow会自动处理

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-29 13:45:11 +08:00