fengsilin
|
caf457ce9e
|
feat: 错误时记录上游响应体,支持流式
- 提取 TruncateBody 公共函数,截断到 2KB 避免日志过大
- 新增 handleResponsesStreamError 统一 SSE 错误提取逻辑
- 流式/非流式 Responses API 错误路径均捕获 UpstreamBody
- 添加 upstream_body 和 truncate_body 单元测试
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
1 неделю назад |
fengsilin
|
332d5a62f2
|
feat: support codex api key credentials
|
1 неделю назад |
fengsilin
|
fae24fdf37
|
test: stabilize channel affinity usage cache tests
|
1 неделю назад |
fengsilin
|
73d10b5799
|
feat: 错误日志记录上游 request-id 和响应体,Playground 渠道路由改为 header 传递
- 错误日志新增 upstream_request_id(从 Anthropic/OpenAI 响应 header 提取)和 upstream_body(截断 2KB)
- 修复 RelayErrorHandler 内部 WithOpenAIError/NewOpenAIError 分支丢失上游字段的 bug
- Playground 渠道和分组改为通过 X-Channel-Id/X-Group header 传递,而非 body 字段
- Distributor 中间件支持从 header 回退读取 channel_id 和 group
Co-Authored-By: Claude <noreply@anthropic.com>
|
1 неделю назад |
fengsilin
|
b693a733ba
|
feat(region-sync): 批量查询用户余额接口,优化同步性能
RunQuotaSync 从逐个查询改为批量查询(每批500个),
减少 Master 节点 API 调用次数,提升同步效率。
新增:
- BatchQueryUserQuota 控制器接口
- BatchQueryQuota 客户端方法
- QuotaEntry/BatchQueryQuotaRequest/Response 类型
附带 update-image.sh 部署脚本。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
4 недель назад |
fengsilin
|
9d4a595465
|
feat(region-sync): Master→Slave 配置同步、热更新与前端修复
- 新增 GET /api/internal/sync/config 接口,Master 下发 MinBalanceThreshold、MaxRetryCount、SyncBatchSize、SyncIntervalSeconds
- Slave 每 5 分钟从 Master 拉取配置并持久化到本地数据库,确保重启不丢失
- 统一 startWorker 支持动态间隔,同步间隔前端修改后无需重启立即生效
- 主节点地址从 TagInput 改为 Form.Input,修复 JSON 数组格式问题
- stringToArray 兼容 JSON 数组和换行分隔两种格式
- 清理根目录测试脚本(已迁移到 test-scripts/)
Co-Authored-By: Claude <noreply@anthropic.com>
|
4 недель назад |
fengsilin
|
dc20782918
|
fix(region-sync): 修复 Settle/SyncManager 竞争条件并优化并发安全
- 新增 settled 状态,防止 SyncManager 在 PreConsume/Settle 之间同步未结算记录
- Settle 使用 AdjustSyncedQuota(增量 gorm.Expr)替代 UpdateSyncedQuota(绝对值),修复并发覆写
- 网络失败时标记所有记录为 failed 并增加 retry_count,避免无限重试
- 新增 ArchiveStalePendingRecords 定时清理崩溃请求的 pending 记录
- 简化 IsSyncedUser/IsLocalUser 移除冗余 id 参数
- Dockerfile 切换华为云 Go 镜像,移除不兼容的 GOEXPERIMENT=greenteagc
Co-Authored-By: Claude <noreply@anthropic.com>
|
4 недель назад |
fengsilin
|
1cecd5349d
|
feat: 跨区域配额同步(Master-Slave Region Sync)
实现 Master-Slave 架构的跨区域用户和配额同步功能,支持国内主节点与
海外从节点之间的用户创建推送、余额同步、预扣费批量回传。
主要变更:
- 新增 region_sync 服务层(SyncManager/SyncClient/推送逻辑)
- User 模型扩展 Source/RemoteUserId/SyncedQuota/LastSyncAt 字段
- BillingSession 支持 SyncedUserFunding 资金来源
- 新增 SyncAuth 中间件(X-Sync-API-Key + 常量时间比较)
- 新增 PendingSyncRecord/QuotaSyncLog 数据模型
- 前端新增区域同步配置面板
- 支持 SESSION_NAME 环境变量避免多节点 cookie 冲突
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
4 недель назад |
winter
|
08164cd0ae
|
fix
|
2 месяцев назад |