Skip to content

Commit

Permalink
fix: Stream模式下使用toolChoice,toolCall的function和type可能为null
Browse files Browse the repository at this point in the history
  • Loading branch information
shilin66 authored and c121914yu committed Sep 12, 2024
1 parent 0abbcf1 commit 424c745
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -442,6 +442,7 @@ async function streamResponse({
toolCalls.push({
...toolCall,
id: toolId,
type: 'function',
function: toolFunction,
toolName: toolNode.name,
toolAvatar: toolNode.avatar
Expand Down

0 comments on commit 424c745

Please sign in to comment.