Commit Graph

10 Commits

Author SHA1 Message Date
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
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
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
litongtongxue
1bd9002af9 docs: 全面更新 CLAUDE.md 文档以反映最新代码实现
## 更新概要

本次更新全面审查了代码库,将严重过期的 CLAUDE.md 文档更新到与当前实现一致。

## 主要更新内容

### 1. 项目概述和架构
- 更新为多平台支持(8种账户类型)
- 添加统一调度系统说明
- 补充权限控制、客户端限制、模型黑名单等新功能

### 2. 服务组件
- 从5个服务扩展到30+个服务的完整列表
- 新增核心转发服务(8个)
- 新增账户管理服务(10个)
- 新增统一调度器(4个)
- 新增核心功能服务(用户管理、定价、Webhook、LDAP等)

### 3. 环境变量配置
- 新增20+个重要环境变量说明
- 添加AWS Bedrock配置
- 添加用户管理、LDAP、Webhook配置说明

### 4. API端点
- 更新为多路由支持(Claude、Gemini、OpenAI、Droid、Azure)
- 新增用户管理端点
- 新增Webhook管理端点
- 新增系统指标端点

### 5. Redis数据结构
- 扩展为8种账户类型的数据结构
- 添加用户管理、粘性会话、并发控制相关键
- 添加成本统计、Webhook配置相关键

### 6. 故障排除
- 从4个问题扩展到13个常见问题
- 新增粘性会话、LDAP、Webhook、调度器等问题解决方案

### 7. CLI工具
- 添加数据导入导出命令
- 添加数据迁移和修复命令
- 添加成本初始化和定价更新命令

### 8. 新增功能概览章节
- 列出相比旧版本的所有新增功能
- 包括多平台支持、用户权限系统、统一调度、成本监控等

## 技术细节

- 保持所有现有章节结构
- 使用 Prettier 格式化确保代码风格一致
- 基于实际代码审查(src/services/、src/routes/、config/等)
- 确保所有端点、配置项、数据结构与代码实现一致

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-15 01:03:57 +08:00
shaw
d2f0ac37a9 feat: 支持Dark Mode 2025-08-22 22:09:38 +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
shaw
dd73045223 feat: 改进 Gemini token 刷新机制和错误处理
- 修复 token 刷新时的错误处理逻辑
- 添加详细的错误日志记录
- 新增 test-gemini-refresh.js 测试脚本
- 更新 CLAUDE.md 文档,添加 Gemini token 刷新故障排除指南

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-26 11:41:17 +08:00
shaw
2257b42527 Modify the default timeout period 2025-07-15 18:00:52 +08:00
shaw
b1ca3f307e first commit 2025-07-14 18:14:13 +08:00