Commit 424c745c by shilin66 Committed by Archer

fix: Stream模式下使用toolChoice,toolCall的function和type可能为null

parent 0abbcf14
......@@ -423,8 +423,8 @@ async function streamResponse({
// Start call tool
if (toolCall.id) {
callingTool = {
name: toolCall.function.name || '',
arguments: toolCall.function.arguments || ''
name: toolCall.function?.name || '',
arguments: toolCall.function?.arguments || ''
};
} else if (callingTool) {
// Continue call
......@@ -442,6 +442,7 @@ async function streamResponse({
toolCalls.push({
...toolCall,
id: toolId,
type: 'function',
function: toolFunction,
toolName: toolNode.name,
toolAvatar: toolNode.avatar
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment