lbyxiaolizi
612436a5a7
fix(openai-compat): Responses→Chat 桥接按 reasoning item id 缓存回注 reasoning_content
...
修复 #5520:Codex 经 force_chat_completions 桥接到 DeepSeek thinking 上游时,
历史中的 encrypted-only reasoning item(summary 为空 + 不透明 encrypted_content,
远程 compaction / 跨会话恢复后常见)取不出明文,后续 assistant 消息缺
reasoning_content,DeepSeek 400 "The reasoning_content in the thinking mode
must be passed back to the API",客户端仅看到通用 502。
reasoning item 的 id 一定会被客户端回传,以其为 key 做服务端缓存:
- GatewayCache 新增 Set/GetReasoningContent(Redis,默认 TTL 7 天)
- 响应侧:流式扫 response.output_item.done、非流式扫 output,把 reasoning
全文按 item id 写缓存;客户端断连后 drain 期间用 detached ctx 仍会写完
- 请求侧:apicompat 新增 ResponsesToChatCompletionsRequestWithOptions 与
ReasoningContentByID 钩子,encrypted-only item 查缓存补回 pendingReasoning;
缓存 miss/出错一律 fail-open 维持原行为
- 自愈:历史里带明文 summary 的 reasoning item 顺手刷新缓存,覆盖 Redis
flush / 跨实例漂移
测试:apicompat(命中恢复/miss 保持原样/明文优先)、service 端到端(流式
写缓存、请求侧回注+自愈)、repository miniredis 存取。
2026-08-17 16:48:36 +08:00
IanShaw027
f3bac4619e
feat(keys): expand Grok client samples and tune free soft-gate default
...
Ship Use Key templates that match Grok Build / Codex best practice: env
vars + multi-model config.toml with api_backend=responses, env_key over
hardcoded secrets, and clearer shell/path guidance for Claude/Codex/OpenCode.
Also set free_quota_token_limit default to 500k (24h soft-gate), clean up
personal-dev-only comments, and keep billing test fixtures aligned.
2026-08-08 10:26:16 +08:00
IanShaw027
7a81468282
fix(grok): 按 review 优先级修复计费漏扣、auth 投影与 free 门禁
...
P0: content 与 status 共用 claim 计费;稳定 grok-video request_id;
auth 热路径投影 video_model_prices。
P1: claim 失败释放可重试;视频绑定 TTL≥24h;SSO 凭据白名单与脱敏;
Token URL 校验;free soft-gate 默认 1M 并统一 free 判定;
Voice 预检余额;STT 抗低报;Realtime 失败不计费;search 未定价告警。
2026-08-07 17:15:43 +08:00
IanShaw027
b59a3df5b5
fix(grok): 视频在 status 返回 video.url 后再按上游参数计费
...
创建/generations 仅绑定账号并缓存 create-time 定价快照;轮询到
video.url / download_url 等成功 URL 时一次性扣费。时长/分辨率/模型
优先取上游 status 字段,缺失则回退创建快照,再套默认 8s/480p。
Redis SetNX + request_id 去重,避免重复轮询双扣。
2026-08-07 16:29:57 +08:00
jjaw
f3a3a0869d
优化并发槽位清理
2026-07-03 21:02:31 +08:00
erio and Claude Opus 4.6
a88698f3fc
feat: cleanup stale concurrency slots on startup
...
When the service restarts, concurrency slots from the old process
remain in Redis, causing phantom occupancy. On startup, scan all
concurrency sorted sets and remove members with non-current process
prefix, then clear orphaned wait queue counters.
Uses Go-side SCAN to discover keys (compatible with Redis client
prefix hooks in tests), then passes them to a Lua script for
atomic member-level cleanup.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-03-09 19:55:18 +08:00
yangjianbo
bb664d9bbf
feat(sync): full code sync from release
2026-02-28 15:01:20 +08:00
yangjianbo
2bfb16291f
fix(unit): 修复 unit tag 测试编译与账号选择用例
2026-02-09 21:35:41 +08:00
yangjianbo and Claude Opus 4.6
bb5a5dd65e
test: 完善自动化测试体系(7个模块,73个任务)
...
系统性地修复、补充和强化项目的自动化测试能力:
1. 测试基础设施修复
- 修复 stubConcurrencyCache 缺失方法和构造函数参数不匹配
- 创建 testutil 共享包(stubs.go, fixtures.go, httptest.go)
- 为所有 Stub 添加编译期接口断言
2. 中间件测试补充
- 新增 JWT 认证中间件测试(有效/过期/篡改/缺失 Token)
- 补充 rate_limiter 和 recovery 中间件测试场景
3. 网关核心路径测试
- 新增账户选择、等待队列、流式响应、并发控制、计费、Claude Code 检测测试
- 覆盖负载均衡、粘性会话、SSE 转发、槽位管理等关键逻辑
4. 前端测试体系(11个新测试文件,163个测试用例)
- Pinia stores: auth, app, subscriptions
- API client: 请求拦截器、响应拦截器、401 刷新
- Router guards: 认证重定向、管理员权限、简易模式限制
- Composables: useForm, useTableLoader, useClipboard
- Components: LoginForm, ApiKeyCreate, Dashboard
5. CI/CD 流水线重构
- 重构 backend-ci.yml 为统一的 ci.yml
- 前后端 4 个并行 Job + Postgres/Redis services
- Race 检测、覆盖率收集与门禁、Docker 构建验证
6. E2E 自动化测试
- e2e-test.sh 自动化脚本(Docker 启动→健康检查→测试→清理)
- 用户注册→登录→API Key→网关调用完整链路测试
- Mock 模式和 API Key 脱敏支持
7. 修复预存问题
- tlsfingerprint dialer_test.go 缺失 build tag 导致集成测试编译冲突
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-02-08 12:05:39 +08:00