andersonby
7ea899bd30
feat: add model name normalization for statistics aggregation in Redis and admin routes
2025-08-07 01:35:01 +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
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
shaw
2ad5d02468
fix: 修复 Gemini 统计功能的多个问题
...
主要修复:
1. geminiRoutes.js 主端点现在使用统一调度器(unifiedGeminiScheduler)
- 支持模型过滤
- 支持账户调度控制
- 与 Claude 保持一致的调度逻辑
2. 修复 Gemini 账户统计数据获取
- admin 路由现在正确获取 Gemini 账户的使用统计
- 使用 redis.getAccountUsageStats 获取真实数据
- 与 Claude 账户统计逻辑保持一致
这些修复确保了 Gemini 服务的数据统计功能正常工作,包括:
- 请求次数统计
- Token 使用量统计
- 模型级别的统计数据
- API Keys 页面和账户管理页面的数据显示
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-08-04 17:35:15 +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
千羽
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
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
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
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
Gemini Wen
ef6de13084
fix: 修复仪表盘统计中遗漏 Claude Console 账户的问题
...
将 Claude Console 账户统计信息纳入系统概览,确保仪表盘显示完整的账户状态和健康检查。
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-07-30 17:22:40 +08:00
shaw
1ca753c79a
fix: 修复API Keys使用趋势图费用计算不准确的问题
...
- 使用模型级别的详细统计数据计算费用,而非固定模型
- 按实际使用的模型(sonnet/opus/haiku等)分别计算价格
- 累加各模型费用得到准确的总费用
- 降级方案改用sonnet模型(中等价格)而非haiku(最低价格)
问题原因:之前使用固定的haiku模型计算所有token的费用,导致价格偏低
解决方案:获取模型级别的使用数据,按实际模型价格计算
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-07-30 15:37:59 +08:00
shaw
321be986a6
feat: 优化仪表盘数据展示和用户体验
...
- 优化实时TPM显示格式,添加智能单位(K/M)
- 折线图tooltip添加token数单位格式化
- API Keys使用趋势图增加USD金额计算和显示
- 实现鼠标悬浮时数据倒序展示,前3名添加🥇 🥈 🥉 标识
- 后端API添加费用计算支持
- 删除测试脚本,保持代码整洁
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-07-30 15:37:58 +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
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
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
43dce7db4e
合并 main 分支到 dev 分支
2025-07-30 10:18:35 +08:00
shaw
d2ac3961e8
Merge remote-tracking branch 'origin/main' into main
2025-07-30 10:17:25 +08:00
shaw
4c64e6df4b
fix(timezone): 修复数据写入时的时区错误(关键修复)
...
- 修复 redis.js 中所有时区相关的日期获取方法
- 使用 getUTC* 方法替代 get* 方法获取正确的时区日期
- 影响:incrementTokenUsage, incrementAccountUsage, incrementDailyCost 等
- 修复 admin.js 中查询数据时的日期键生成
- 确保所有 Redis 键格式一致:
- 日期:YYYY-MM-DD
- 月份:YYYY-MM
- 小时:YYYY-MM-DD:HH
- 添加服务端时间标签,避免前端时区转换问题
这是核心修复,确保数据从源头就是正确的。
2025-07-30 10:07:25 +08:00
shaw
5503004b66
fix(admin): 修复时区转换和时间显示格式问题
...
- 修复小时粒度下时间显示为完整日期的问题
- 修复时区转换逻辑,使用正确的UTC偏移计算
- 统一时间标签格式:小时粒度显示MM/DD HH:00,天粒度显示MM/DD
- 修复图表时间显示比实际时间快7小时的问题
2025-07-30 09:42:09 +08:00
KevinLiao
34dca961ef
fix: 1. 修复调度优先级以及手动禁止调度逻辑的问题
...
2. 优化列表优先级显示
2025-07-30 09:30:11 +08:00
shaw
61b1a0ec32
fix(admin-spa): 修复时区问题导致的图表时间显示不一致和今日统计错误
2025-07-30 09:18:55 +08:00
KevinLiao
fddd5ee3e9
feat: 新增标准Claude Console API账号支持
2025-07-30 08:19:44 +08:00
shaw
03a5300b78
feat(admin-spa): 添加 API Key 标签管理功能
...
基于 PR #114 的功能需求,为新版 admin-spa 实现完整的标签系统:
后端改进:
- apiKeyService 支持标签的创建、查询和更新
- admin 路由添加标签验证和处理逻辑
- 标签以 JSON 数组形式存储在 Redis 中
前端功能:
- API Key 列表增加标签列,显示彩色标签徽章
- 添加标签筛选器,支持按标签过滤 API Keys
- 创建和编辑 API Key 时可添加/删除标签
- 标签输入支持 Enter 键快速添加
- 自动收集并排序所有可用标签
界面优化:
- 使用蓝色圆角标签样式,视觉清晰
- 无标签时显示"无标签"提示
- 标签管理操作流畅,支持即时添加删除
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-07-29 16:14:16 +08:00
Edric Li
9193d64d2a
feat: 添加 OEM 设置功能并统一 API 统计页面样式
...
- 添加 OEM 设置管理功能,支持自定义网站名称和图标
- 支持图标文件上传和 Base64 编码存储
- 实现动态更新网站标题和 favicon
- 统一 API 统计页面与管理页面的样式和布局
- 修复文本颜色显示问题,提升可读性
- 优化错误处理和默认值回退机制
- 移除测试文件和冗余代码
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-07-27 23:20:44 +08:00
KevinLiao
ac1e367a69
feat: 增加每日费用限制
2025-07-27 14:47:59 +08:00
KevinLiao
375d70ee1f
feat: APIKeys 列表,统计周期选项增加今日。
2025-07-27 12:03:22 +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
1cf70a627f
添加claude账号维度计算token费用
2025-07-25 21:36:17 +08:00
leslie
5522967792
添加claude账号维度计算token费用
2025-07-25 21:27:17 +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
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
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
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
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
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
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
5a0271d536
fix: 统一仪表盘Token消耗费用计算逻辑
...
- 修复今日费用和总费用计算不一致的问题
- 总费用计算现在优先使用Redis中的详细模型统计数据
- 使用真实模型价格进行费用计算,而不是固定的'unknown'价格
- 添加智能回退机制,无模型数据时使用Haiku价格
- 增加详细的日志记录以便跟踪费用计算过程
- 解决了总Token消耗大但费用显示偏低的异常问题
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-07-16 16:41:54 +08:00
shaw
567e3b25aa
feat: 优化并发控制和移除冗余限制功能
...
主要改进:
1. 改进并发控制机制
- 使用 once 代替 on 避免重复监听
- 监听多个事件确保可靠性(close、finish)
- 支持客户端断开时立即释放并发槽位
2. 支持非流式请求的客户端断开处理
- 客户端断开时立即中断上游请求
- 避免资源浪费和不必要的 API 调用
3. 移除 requestLimit(请求数限制)功能
- 移除配置和验证逻辑
- 保留请求统计用于监控分析
4. 移除速率限制(Rate Limit)功能
- 移除 RATE_LIMIT_* 配置
- 简化中间件逻辑
- 避免与并发控制重复
现在系统仅保留:
- Token 使用量限制
- 并发数限制(更精确的资源控制)
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-07-16 14:40:37 +08:00
shaw
12b41ceb25
feat: 添加API Key并发控制和编辑功能
...
- 新增API Key并发控制功能
- 创建API Key时可设置并发限制(0为不限制)
- 在认证中间件中实现并发检查
- 使用Redis原子操作确保计数准确
- 添加自动清理机制处理异常情况
- 新增API Key编辑功能
- 支持修改Token限制和并发限制
- 前端添加编辑按钮和模态框
- 后端限制只能修改指定字段
- 其他改进
- 添加test-concurrency.js测试脚本
- 添加详细的功能说明文档
- 所有代码通过ESLint检查
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com >
2025-07-16 09:48:07 +08:00