fix(openai-responses): keep open function calls when starting text/thinking
- Stopped prematurely closing function call parts on output_text and thinking_start. - Only close the open part when it is not a function_call.
This commit is contained in:
@@ -966,8 +966,7 @@ export function encodeStream(
|
||||
cur = state.open;
|
||||
cur.currentPartText = "";
|
||||
} else {
|
||||
closeOpenFunctionCalls();
|
||||
if (state.open) closeOpen();
|
||||
if (state.open && state.open.kind !== "function_call") closeOpen();
|
||||
cur = openMessage();
|
||||
}
|
||||
const part = { type: "output_text", text: "", annotations: [] as never[] };
|
||||
@@ -1018,8 +1017,7 @@ export function encodeStream(
|
||||
break;
|
||||
}
|
||||
case "thinking_start": {
|
||||
closeOpenFunctionCalls();
|
||||
if (state.open) closeOpen();
|
||||
if (state.open && state.open.kind !== "function_call") closeOpen();
|
||||
openReasoning(ev.partial, ev.contentIndex);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user