fix: re-add newline separator between reasoning_summary parts after openai middleware refactor (#7390)

re-add newline separator between reasoning_summary parts after openai client refactor

Signed-off-by: MurphyLo <murphylo@mail.bnu.edu.cn>
This commit is contained in:
Murphy 2025-06-23 12:51:08 +08:00 committed by GitHub
parent 32d6c2e1d8
commit a2e2eb3b73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -425,6 +425,7 @@ export class OpenAIResponseAPIClient extends OpenAIBaseClient<
const toolCalls: OpenAIResponseSdkToolCall[] = []
const outputItems: OpenAI.Responses.ResponseOutputItem[] = []
let hasBeenCollectedToolCalls = false
let hasReasoningSummary = false
return () => ({
async transform(chunk: OpenAIResponseSdkRawChunk, controller: TransformStreamDefaultController<GenericChunk>) {
// 处理chunk
@ -496,6 +497,16 @@ export class OpenAIResponseAPIClient extends OpenAIBaseClient<
outputItems.push(chunk.item)
}
break
case 'response.reasoning_summary_part.added':
if (hasReasoningSummary) {
const separator = '\n\n'
controller.enqueue({
type: ChunkType.THINKING_DELTA,
text: separator
})
}
hasReasoningSummary = true
break
case 'response.reasoning_summary_text.delta':
controller.enqueue({
type: ChunkType.THINKING_DELTA,