fix(translator): stop emitting empty <think> markers into OpenAI content
This commit is contained in:
@@ -129,12 +129,16 @@ export function openaiToOpenAIResponsesResponse(chunk, state) {
|
||||
}
|
||||
|
||||
if (content) {
|
||||
// The answer starts, so thinking is over. Upstreams that send reasoning via
|
||||
// reasoning_content never emit "</think>", so close it here rather than at finish.
|
||||
closeReasoning(state, emit);
|
||||
emitTextContent(state, emit, idx, content);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle tool_calls (empty array is truthy; require a real call)
|
||||
if (delta.tool_calls && delta.tool_calls.length) {
|
||||
closeReasoning(state, emit);
|
||||
closeMessage(state, emit, idx);
|
||||
for (const tc of delta.tool_calls) {
|
||||
emitToolCall(state, emit, tc);
|
||||
|
||||
Reference in New Issue
Block a user