Repository navigation
Conversation
Codex 上游只回 SSE,非流式客户端拿到的 SSE 体被 OpenAI SDK 当作字符串返回, 访问 .choices/.output 即报 AttributeError。非流式请求(未显式 stream:true) 现聚合 response.completed 事件为单条 Responses JSON 返回;流式请求行为不变。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
Codex 上游只回 SSE(
normalizeBody强制上游stream:true,响应恒设text/event-stream)。非流式客户端(未显式stream:true)拿到的 SSE 体被 OpenAI SDK 当作字符串返回,调用方访问.choices/.output抛AttributeError。实际影响:经 new-api 渠道 4(
codex-bridge)调用gpt-*的非流式调用方(如 BiliNote)笔记生成全部失败。改动
src/proxy.js:非流式请求把上游response.completed(含response.done/response.incomplete)事件聚合为单条 Responses JSON 返回;无 completed 事件时按response.output_text.delta兜底合成。流式请求行为不变。test/smoke.js:拆分流式(SSE 透传)与非流式(JSON 聚合)两条断言。验证
npm test:ALL TESTS PASSED。192.168.5.21:3010,模型gpt-5.6-luna):stream:false→200 application/json+chat.completion;stream:true→200 text/event-stream不变。PENDING → TRANSCRIBING → SUCCESS。