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
..
2026-07-01 11:32:22 +08:00
2026-08-07 16:14:37 +08:00
2026-08-17 16:48:36 +08:00
2026-07-26 19:20:11 +08:00
2026-08-07 20:49:39 +08:00
2026-02-28 15:01:20 +08:00
2026-05-20 09:28:46 +08:00
2026-05-20 09:28:46 +08:00
2026-02-05 20:17:53 +08:00
2026-07-14 01:29:30 +08:00
2026-07-09 11:15:52 +08:00
2026-08-06 20:34:37 +08:00
2026-07-18 00:11:18 +08:00
2026-08-01 15:03:59 +08:00
2026-08-07 09:56:03 +08:00
2026-05-14 11:46:24 +08:00
2026-07-13 11:35:46 +08:00
2026-03-02 16:04:20 +08:00
2026-08-03 19:59:58 +08:00
2026-08-07 16:29:48 +08:00
2026-03-16 20:22:10 +08:00
2026-07-15 00:23:27 +08:00
2026-01-04 19:28:20 +08:00
2026-07-02 16:11:07 +08:00
2026-07-16 09:51:41 +08:00
2026-08-14 22:34:43 +08:00
2026-04-14 12:19:44 +08:00
2026-08-13 08:55:56 +08:00