mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-21 09:01:20 +00:00
fix(ai): tolerate malformed trailing tool-call JSON in OpenAI streams closes #1424
This commit is contained in:
parent
5ddb04f74a
commit
ed0cfcbda2
2 changed files with 3 additions and 3 deletions
|
|
@ -414,8 +414,8 @@ export async function processResponsesStream<TApi extends Api>(
|
|||
} else if (item.type === "function_call") {
|
||||
const args =
|
||||
currentBlock?.type === "toolCall" && currentBlock.partialJson
|
||||
? JSON.parse(currentBlock.partialJson)
|
||||
: JSON.parse(item.arguments);
|
||||
? parseStreamingJson(currentBlock.partialJson)
|
||||
: parseStreamingJson(item.arguments || "{}");
|
||||
const toolCall: ToolCall = {
|
||||
type: "toolCall",
|
||||
id: `${item.call_id}|${item.id}`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue