fix: toolcall index not start zero (#5811)

This commit is contained in:
Archer 2025-10-24 17:49:18 +08:00 committed by GitHub
parent 68271c0846
commit d87771a14a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -57,7 +57,7 @@ type LLMResponse = {
completeMessages: ChatCompletionMessageParam[];
};
/*
/*
LLM stream stream toolChoice promptTool
toolChoice promptTool toolChoice messages
*/
@ -243,7 +243,7 @@ export const createStreamResponse = async ({
type: 'function',
function: callingTool!
};
toolCalls.push(call);
toolCalls[index] = call;
onToolCall?.({ call });
callingTool = null;
}
@ -268,7 +268,7 @@ export const createStreamResponse = async ({
reasoningText: reasoningContent,
finish_reason,
usage,
toolCalls
toolCalls: toolCalls.filter((call) => !!call)
};
} else {
let startResponseWrite = false;