sakurawztlt
a1e299a355
fix: Anthropic 非流式路径在上游终态事件 output 为空时从 delta 事件重建响应内容
b2e379cf 引入的 BufferedResponseAccumulator 已修复了 chat_completions
非流式路径和 responses OAuth 非流式路径,但遗漏了 Anthropic /v1/messages
非流式路径 (handleAnthropicBufferedStreamingResponse)。
当客户端请求 stream=false 且模型开启思考时,上游 response.completed
终态事件的 output 字段可能为空,实际 message 内容通过
response.output_text.delta 增量事件下发。旧代码只读终态事件的 Response,
导致客户端收到的 content 字段为空 ([{"type":"text"}])。
本 commit 将 b2e379cf 的相同修复模式镜像到 Anthropic 路径:在 SSE 扫描
过程中用 BufferedResponseAccumulator 累积 delta 内容,终态 output 为空
时通过 SupplementResponseOutput 补充重建。
同时修复 handleAnthropicBufferedStreamingResponse 遗漏 response.done
事件类型的问题,与 chat completions 路径保持一致,避免上游发送
response.done 时 handler 认不出终态事件、最终返回 502 的潜在问题。
BufferedResponseAccumulator 已在 chatcompletions_responses_test.go 有
完整单元测试覆盖(TextOnly/ToolCalls/Reasoning/Mixed/SupplementEmpty/
NoSupplementWhenOutputExists/EmptyDeltas/IgnoresNonFunctionCallItems),
本次复用相同累加器无需新增测试。
2026-04-13 18:51:49 +08:00
..
2026-03-23 03:49:28 +08:00
2026-03-31 13:24:22 +08:00
2026-03-23 10:16:52 +08:00
2026-04-05 17:11:01 +08:00
2026-04-05 17:11:01 +08:00
2026-04-05 17:22:22 +08:00
2026-04-05 17:22:22 +08:00
2026-04-04 14:32:26 +08:00
2026-04-01 02:19:42 +08:00
2026-04-01 02:19:42 +08:00
2026-03-19 22:27:55 +08:00
2026-03-30 00:22:02 +08:00
2026-03-19 22:27:55 +08:00
2026-04-09 21:35:48 +08:00
2026-04-09 18:14:28 +08:00
2026-04-05 17:11:01 +08:00
2026-04-09 18:14:28 +08:00
2026-04-09 21:35:48 +08:00
2026-04-04 14:32:26 +08:00
2026-04-04 14:32:26 +08:00
2026-03-27 14:33:05 +08:00
2026-04-04 14:32:26 +08:00
2026-03-27 20:11:24 +08:00
2026-03-27 20:18:07 +08:00
2026-04-01 02:19:42 +08:00
2026-04-01 12:24:52 +08:00
2026-03-25 19:03:12 +08:00
2026-03-25 17:38:41 +08:00
2026-03-27 14:33:05 +08:00
2026-04-05 17:21:36 +08:00
2026-03-25 19:03:12 +08:00
2026-03-23 03:49:28 +08:00
2026-04-10 17:55:37 +08:00
2026-04-10 17:55:37 +08:00
2026-04-10 17:55:37 +08:00
2026-03-19 22:27:55 +08:00
2026-03-19 22:27:55 +08:00
2026-03-19 22:27:55 +08:00
2026-04-09 02:20:51 +00:00
2026-04-05 17:11:01 +08:00
2026-04-05 17:11:01 +08:00
2026-04-05 22:32:49 +08:00
2026-04-05 22:32:49 +08:00
2026-04-04 11:25:01 +08:00
2026-04-04 11:25:01 +08:00
2026-03-18 11:08:58 +08:00
2026-03-23 03:49:28 +08:00
2026-03-18 14:16:50 +08:00
2026-04-09 21:35:48 +08:00
2026-03-21 23:36:30 +08:00
2026-03-27 14:33:05 +08:00
2026-04-08 14:06:06 +08:00
2026-04-08 16:11:19 +08:00
2026-04-08 16:23:02 +08:00
2026-03-19 16:56:18 +08:00
2026-04-04 11:25:01 +08:00
2026-04-04 11:25:01 +08:00
2026-03-26 11:17:25 +08:00
2026-03-24 09:32:34 +08:00
2026-03-27 14:33:05 +08:00
2026-03-24 09:32:34 +08:00
2026-03-27 14:33:05 +08:00
2026-04-04 12:38:50 +08:00
2026-04-04 12:38:50 +08:00
2026-04-08 14:06:06 +08:00
2026-04-04 11:12:21 +08:00
2026-03-22 17:26:44 +08:00
2026-03-24 15:19:01 +08:00
2026-04-05 17:11:01 +08:00
2026-04-08 10:39:15 -07:00
2026-04-01 00:45:56 +08:00
2026-04-08 10:39:15 -07:00
2026-03-23 10:16:52 +08:00
2026-03-24 09:32:01 +08:00
2026-03-24 09:32:01 +08:00
2026-03-23 03:49:28 +08:00
2026-03-24 09:31:32 +08:00
2026-03-18 10:06:35 +08:00
2026-03-18 10:06:35 +08:00
2026-04-09 12:29:28 +08:00
2026-03-30 11:43:07 +08:00
2026-03-27 14:33:05 +08:00
2026-03-19 16:56:18 +08:00
2026-03-26 11:17:25 +08:00
2026-03-27 20:11:24 +08:00
2026-03-18 11:08:58 +08:00
2026-03-18 11:08:58 +08:00
2026-04-04 11:17:49 +08:00
2026-04-04 15:15:33 +08:00
2026-03-30 16:23:38 +08:00
2026-03-30 16:44:15 +08:00
2026-03-23 03:50:03 +08:00
2026-03-31 13:04:55 +08:00
2026-04-04 11:25:01 +08:00
2026-04-09 12:29:49 +08:00
2026-03-24 19:20:15 +08:00
2026-04-07 11:27:57 +03:00
2026-04-09 12:29:49 +08:00
2026-03-29 20:52:29 +08:00
2026-03-24 19:20:15 +08:00
2026-04-04 14:07:19 +08:00
2026-04-02 00:11:17 +08:00
2026-04-02 01:03:22 +08:00
2026-04-07 20:37:10 +08:00
2026-04-13 18:51:49 +08:00
2026-04-05 17:31:18 +08:00
2026-04-01 00:46:38 +08:00
2026-04-08 14:17:49 +08:00
2026-04-08 10:39:15 -07:00
2026-04-09 12:29:28 +08:00
2026-04-09 12:29:28 +08:00
2026-04-07 11:27:57 +03:00
2026-04-04 14:07:19 +08:00
2026-03-30 22:29:26 +08:00
2026-04-05 17:11:01 +08:00
2026-03-30 00:21:51 +08:00
2026-04-05 17:21:36 +08:00
2026-03-23 00:10:22 +08:00
2026-04-02 20:44:28 +08:00
2026-04-05 17:11:01 +08:00
2026-04-05 17:11:01 +08:00
2026-03-23 03:50:03 +08:00
2026-04-07 11:40:41 +03:00
2026-04-04 11:13:43 +08:00
2026-04-09 18:14:28 +08:00
2026-03-20 18:22:00 +08:00
2026-03-23 10:16:52 +08:00
2026-03-21 23:30:13 +08:00
2026-03-21 23:30:13 +08:00
2026-04-04 12:38:50 +08:00
2026-04-09 17:49:02 +08:00
2026-03-21 23:49:50 +08:00
2026-03-21 23:30:13 +08:00
2026-03-18 16:22:19 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-03-19 19:03:13 +08:00
2026-04-04 11:15:59 +08:00
2026-03-23 03:49:28 +08:00
2026-04-12 13:30:15 +08:00
2026-03-23 10:16:52 +08:00
2026-04-03 01:50:26 +08:00
2026-04-08 10:39:15 -07:00
2026-03-31 13:04:55 +08:00
2026-04-09 02:20:51 +00:00
2026-04-09 18:14:28 +08:00
2026-04-09 18:14:28 +08:00
2026-04-11 18:25:06 +08:00
2026-04-11 18:25:06 +08:00
2026-03-18 11:32:35 +08:00
2026-03-18 09:23:19 +08:00
2026-04-04 11:13:58 +08:00
2026-03-27 14:33:05 +08:00
2026-04-05 17:11:01 +08:00
2026-03-30 00:21:51 +08:00
2026-04-05 17:11:01 +08:00
2026-04-05 17:11:01 +08:00
2026-04-05 17:11:01 +08:00
2026-04-04 11:09:01 +08:00
2026-04-05 17:11:01 +08:00
2026-03-19 22:27:55 +08:00
2026-03-19 22:27:55 +08:00
2026-03-18 09:23:19 +08:00
2026-04-05 17:11:01 +08:00
2026-04-11 13:16:35 +08:00