shaw
84f19b348b
fix: 适配cc遥测端点
2025-12-21 22:29:36 +08:00
shaw
8ec8a59b07
feat: claude账号新增支持拦截预热请求
2025-12-21 22:28:22 +08:00
shaw
00d8ac4bec
Merge branch 'main' into dev
2025-12-21 21:35:16 +08:00
atoz03
b6f3459522
修复 eslint
2025-12-20 01:40:41 +08:00
atoz03
4c6879a9c2
Prettier 格式化
2025-12-20 01:24:08 +08:00
atoz03
f6f4b5cfec
feat(admin): 余额脚本驱动的余额/配额刷新与管理端体验修复
...
- 明确刷新语义:仅脚本启用且已配置时触发远程查询;未配置时前端禁用并提示\n- 新增余额脚本安全开关 BALANCE_SCRIPT_ENABLED(默认开启),脚本测试接口受控\n- Redis 增加单账户脚本配置存取,响应透出 scriptEnabled/scriptConfigured 供 UI 判定\n- accountBalanceService:本地统计汇总改用 SCAN+pipeline,避免 KEYS;仅缓存远程成功结果,避免失败/降级覆盖有效缓存\n- 管理端体验:刷新按钮按配置状态灰置;脚本弹窗内容可滚动、底部操作栏固定,并 append-to-body 使弹窗跟随当前视窗
2025-12-20 01:18:49 +08:00
atoz03
26ca696b91
fix:修复了重复声明 redis 导致的启动报错,并保留余额脚本功能接入账户
2025-12-20 01:18:49 +08:00
atoz03
ce496ed9e6
feat:单账户配置余额脚本 + 刷新按钮即用脚本”,并去掉独立页面/标签。
...
具体改动
- 后端
- src/models/redis.js:新增脚本配置存取 account_balance_script:{platform}:{accountId}。
- src/services/accountBalanceService.js:支持脚本查询。若账户有脚本配置且 queryApi=true,调用 balanceScriptService.execute 获取余额/配额,缓存后返回。
- src/routes/admin/accountBalance.js:新增接口
- GET /admin/accounts/:id/balance/script?platform=...
- PUT /admin/accounts/:id/balance/script?platform=...
- POST /admin/accounts/:id/balance/script/test?platform=...
- 前端
- 新增弹窗 AccountBalanceScriptModal,在账户管理页每个账户“余额/配额”下方有“配置余额脚本”按钮,支持填写 baseUrl/apiKey/token/extra/超时/自动间隔、编写脚本、测试、保存。
- 将余额脚本独立路由/标签移除。
- 格式/ lint 已通过(新组件及 AccountsView)。
2025-12-20 01:18:49 +08:00
atoz03
f6ed420401
feat(admin): 新增账户余额/配额查询与展示
...
- 新增 accountBalanceService 与多 Provider 适配(Claude/Claude Console/OpenAI Responses/通用)
- Redis 增加余额查询结果与本地统计缓存读写
- 管理端新增 /admin/accounts/balance 相关接口与汇总接口,并在应用启动时注册 Provider
- 后台前端新增余额组件与 Dashboard 余额/配额汇总、低余额/高使用提示
- 补充 accountBalanceService 单元测试
2025-12-20 01:15:33 +08:00
shaw
638d2ff189
feat: 支持claude单账户开启串行队列
2025-12-19 22:29:57 +08:00
guoyongchang
dd8a0c95c3
fix: use template literals instead of string concatenation
...
- Convert string concatenation to template literals per ESLint prefer-template rule
- Fixes ESLint errors in sessionKeyPrefix logging (lines 281, 330)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com >
2025-12-19 15:46:38 +08:00
guoyongchang
126eee3712
feat/cron-test-support format fix.
2025-12-19 14:59:47 +08:00
guoyongchang
26bfdd6892
[feat/cron-test-support]optimize.
2025-12-19 14:03:31 +08:00
guoyongchang
cd3f51e9e2
refactor: optimize cron test support feature
...
**优化内容:**
1. **验证和安全性加强**
- 移除cron验证重复,统一使用accountTestSchedulerService.validateCronExpression()方法
- 添加model参数类型和长度验证(max 256 chars)
- 限制cronExpression长度至100字符防止DoS攻击
- 双层验证:service层和route层都进行长度检查
2. **性能优化**
- 优化_refreshAllTasks()使用Promise.all()并行加载所有平台配置(之前是顺序加载)
- 改进错误处理,平台加载失败时继续处理其他平台
3. **数据管理改进**
- 为test config添加1年TTL过期机制(之前没有过期设置)
- 保证test history已有30天TTL和5条记录限制
4. **错误响应标准化**
- 统一所有API响应格式,确保error状态都包含message字段
- 改进错误消息的可读性和上下文信息
5. **用户体验改进**
- Vue组件使用showToast()替代原生alert()
- 移除console.error()改用toast通知用户
- 成功保存时显示成功提示
6. **代码整理**
- 移除未使用的maxConcurrentTests变量及其getStatus()中的引用
- 保持代码整洁性
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com >
2025-12-19 13:39:39 +08:00
guoyongchang
09cf951cdc
[feat/cron-test-support]done.
2025-12-19 10:25:43 +08:00
Guccbai
33ea26f2ac
feat(permissions): 服务权限从单选改为多选
...
- 将 API Key 的服务权限从单选改为多选,支持同时选择多个服务
- 移除"全部服务"选项,空数组表示允许访问全部服务
- 后端自动兼容旧格式('all' -> [], 'claude' -> ['claude'])
- 前端 radio 改为 checkbox,更新账户选择器联动逻辑
修改文件:
- apiKeyService.js: 添加 normalizePermissions/hasPermission 函数
- api.js, droidRoutes.js, openaiRoutes.js, unified.js, openaiGeminiRoutes.js, geminiHandlers.js: 使用新权限验证函数
- admin/apiKeys.js: 支持数组格式权限验证
- CreateApiKeyModal.vue, EditApiKeyModal.vue: UI 改为 checkbox 多选
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-17 11:35:11 +08:00
Wesley Liddick
53cda0fd18
Merge pull request #806 from XiaoXice/main [skip ci]
...
fix: 全时间api-token统计因为日token记录过期导致不准的问题
2025-12-16 19:34:35 -05:00
sususu
0994eb346f
format
2025-12-16 18:32:11 +08:00
sususu
4863a37328
feat: 添加 Claude Code 遥测端点并优化日志级别
...
- 添加 /api/event_logging/batch 端点处理客户端遥测请求
- 将遥测相关请求日志改为 debug 级别,减少日志噪音
2025-12-16 18:31:07 +08:00
huajiwuyan
052e236a93
fix(scheduler): 恢复OpenAI 账号选择支持 priority + lastUsedAt
2025-12-15 23:17:44 +08:00
XiaoXice
c79ea19aa1
fix: 全时间api-token统计因为日token记录过期导致不准的问题
2025-12-15 15:14:09 +08:00
Wesley Liddick
bd7b8884ab
Merge pull request #801 from miraserver/fix/cost-calculation-and-ui-display
...
fix: correct API key cost calculation and UI display issues
2025-12-14 20:48:00 -05:00
shaw
ce13e5ddb1
fix: console账号转发使用白名单透传header
2025-12-15 09:38:51 +08:00
John Doe
baafebbf7b
fix: correct API key cost calculation and UI display issues
...
- Fix admin panel cost display for "all time" period using permanent Redis key
- Fix user statistics total cost limit to show complete history
- Fix restricted models list overflow with scrollable container
Backend changes:
- src/routes/admin/apiKeys.js: Use allTimeCost for timeRange='all' instead of scanning TTL keys
- src/routes/apiStats.js: Prioritize permanent usage:cost:total key over monthly keys
Frontend changes:
- web/admin-spa/src/components/apistats/LimitConfig.vue: Add overflow-visible and scrolling to model list
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-12 18:11:02 +03:00
Wesley Liddick
60f5cbe780
Merge pull request #800 from DaydreamCoding/feature/concurrency-queue
...
feat: enhance concurrency queue with health check and admin endpoints
2025-12-12 01:58:24 -05:00
DaydreamCoding
07633ddbf8
feat: enhance concurrency queue with health check and admin endpoints
...
- Add queue health check for fast-fail when overloaded (P90 > threshold)
- Implement socket identity verification with UUID token
- Add wait time statistics (P50/P90/P99) and queue stats tracking
- Add admin endpoints for queue stats and cleanup
- Add CLEAR_CONCURRENCY_QUEUES_ON_STARTUP config option
- Update documentation with troubleshooting and proxy config guide
2025-12-12 14:32:09 +08:00
kikii16
ceee3a9295
Update auth.js
2025-12-12 11:34:46 +08:00
LZY
51aa8dc381
fix:修复codex统计token问题
2025-12-10 22:56:25 +08:00
Wesley Liddick
4337af06d4
Merge pull request #791 from DaydreamCoding/feature/log-opt
...
fix: improve logging for client disconnections in relay services
2025-12-10 07:11:24 -05:00
Wesley Liddick
d226d57325
Merge pull request #790 from DaydreamCoding/patch-4 [skip ci]
...
fix(security): add authenticateAdmin middleware to concurrency routes
2025-12-10 07:11:07 -05:00
QTom
8901994644
fix: improve logging for client disconnections in relay services
...
当客户端主动断开连接时,改为使用 INFO 级别记录而不是 ERROR 级别,
因为这是正常情况而非错误。
- ccrRelayService: 区分客户端断开与实际错误
- claudeConsoleRelayService: 区分客户端断开与实际错误
- claudeRelayService: 区分客户端断开与实际错误
- droidRelayService: 区分客户端断开与实际错误
2025-12-10 14:18:44 +08:00
QTom
e3ca555df7
fix(security): add authenticateAdmin middleware to concurrency routes
...
fix(security): add authenticateAdmin middleware to concurrency routes
All concurrency management endpoints were missing authentication,
allowing unauthenticated access to view and clear concurrency data.
2025-12-10 13:59:25 +08:00
QTom
3b9c96dff8
feat(queue): 优化用户消息队列锁释放时机
...
将队列锁释放时机从"请求完成后"提前到"请求发送后",因为 Claude API
限流(RPM)基于请求发送时刻计算,无需等待响应完成。
主要变更:
- 移除锁续租机制(startLockRenewal、refreshUserMessageLock)
- 所有 relay 服务在请求发送成功后立即释放锁
- 流式请求通过 onResponseStart 回调在收到响应头时释放
- 调整默认配置:timeoutMs 60s→5s,lockTtlMs 120s→5s
- 新增 USER_MESSAGE_QUEUE_LOCK_TTL_MS 环境变量支持
2025-12-10 01:26:00 +08:00
QTom
b409adf9d8
feat: 修复 userMessageQueue 配置缺失导致的 500 错误
...
- 在 config.example.js 添加缺失的 userMessageQueue 配置段
- 在 userMessageQueueService.js 添加防御性代码,当配置未定义时使用默认值
修复 #783 合并后新用户安装报错:
Cannot read properties of undefined (reading 'enabled')
2025-12-09 18:41:13 +08:00
QTom
dc96447d72
style: 格式化文件以符合 Prettier 规范
2025-12-09 17:18:43 +08:00
QTom
f5d1c25295
feat: 添加用户消息串行队列功能,防止同账户并发请求触发限流
...
- 新增 userMessageQueueService.js 实现基于 Redis 的队列锁机制
- 在 claudeRelayService、claudeConsoleRelayService、bedrockRelayService、ccrRelayService 中集成队列锁
- 添加 Redis 原子性 Lua 脚本:acquireUserMessageLock、releaseUserMessageLock、refreshUserMessageLock
- 支持锁续租机制,防止长时间请求锁过期
- 添加可配置参数:USER_MESSAGE_QUEUE_ENABLED、USER_MESSAGE_QUEUE_DELAY_MS、USER_MESSAGE_QUEUE_TIMEOUT_MS
- 添加 Web 管理界面配置入口
- 添加 logger.performance 方法用于结构化性能日志
- 添加完整单元测试 (tests/userMessageQueue.test.js)
2025-12-09 17:04:01 +08:00
shaw
aa71c58400
fix: 修复强制会话绑定首次会话的bug
2025-12-08 21:05:21 +08:00
shaw
5a18f54abd
Merge branch 'dev'
2025-12-08 16:08:10 +08:00
shaw
c79fdc4d71
feat: 增加Claude会话强制绑定
2025-12-08 16:06:23 +08:00
shaw
659072075d
fix: 统一格式化claude参数传递
2025-12-08 14:23:13 +08:00
sususu
cf93128a96
fix: format
2025-12-08 11:01:10 +08:00
sususu
909b5ad37f
fix: 添加 Explore agent 系统提示词模板并优化日志级别
...
- 添加 exploreAgentSystemPrompt 模板用于匹配 Claude Code Explore 子代理
- 将详细的 prompt 内容从 error 日志移至 warn 级别,减少日志噪音
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-08 10:45:46 +08:00
shaw
bab7073822
fix: 修复api-keys页面窗口费率显示问题
2025-12-08 09:58:54 +08:00
shaw
d49cc0cec8
fix: 修复api-keys页面窗口费率显示问题
2025-12-08 09:45:19 +08:00
John Doe
24796fc889
fix: format droidAccountService.js with Prettier
2025-12-07 21:14:42 +03:00
John Doe
201d95c84e
[fix] Droid: dynamic x-api-provider and custom User-Agent support
...
- Dynamic x-api-provider selection for OpenAI endpoint based on model
- Models with '-max' suffix use 'openai' provider
- Other models use 'azure_openai' provider
- Fixes gpt-5.1-codex-max model compatibility issue
- Update default User-Agent to factory-cli/0.32.1
- Add custom User-Agent field for Droid accounts
- Backend: userAgent field in createAccount and updateAccount
- Frontend: User-Agent input in account creation/edit UI
- Supports all Droid auth modes: OAuth, Manual, API Key
This resolves the issue where gpt-5.1-codex-max failed with 'Azure OpenAI only supports...' error due to incorrect provider header.
2025-12-07 21:08:48 +03:00
Wesley Liddick
b978d864e3
Merge pull request #776 from miraserver/fix/droid-openai-cache-tokens [skip ci]
...
[fix] Add cache token capture for Droid OpenAI endpoint
2025-12-06 22:46:54 -05:00
Wesley Liddick
eb2341fb16
Merge pull request #771 from DaydreamCoding/patch-2 [skip ci]
...
Update model filtering to use blacklist approach
2025-12-06 22:43:52 -05:00
Wesley Liddick
e89e2964e7
Merge pull request #773 from DaydreamCoding/feature/concurrency [skip ci]
...
feat(concurrencyManagement): implement concurrency status management …
2025-12-06 22:43:29 -05:00
John Doe
b3e27e9f15
[fix] Add cache token capture for Droid OpenAI endpoint
...
The _parseOpenAIUsageFromSSE method was not capturing cache-related
tokens (cache_read_input_tokens, cache_creation_input_tokens) from
OpenAI format responses, while the Anthropic endpoint correctly
captured them.
This fix adds extraction of:
- cached_tokens from input_tokens_details
- cache_creation_input_tokens from both input_tokens_details and
top-level usage object
This ensures proper cache statistics tracking and cost calculation
for OpenAI models (like GPT-5/Codex) when using the Droid provider.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-06 23:00:54 +03:00