fix: Stream模式下使用toolChoice,toolCall的function和type可能为null
This commit is contained in:
parent
0abbcf1401
commit
424c745cbb
@ -423,8 +423,8 @@ async function streamResponse({
|
|||||||
// Start call tool
|
// Start call tool
|
||||||
if (toolCall.id) {
|
if (toolCall.id) {
|
||||||
callingTool = {
|
callingTool = {
|
||||||
name: toolCall.function.name || '',
|
name: toolCall.function?.name || '',
|
||||||
arguments: toolCall.function.arguments || ''
|
arguments: toolCall.function?.arguments || ''
|
||||||
};
|
};
|
||||||
} else if (callingTool) {
|
} else if (callingTool) {
|
||||||
// Continue call
|
// Continue call
|
||||||
@ -442,6 +442,7 @@ async function streamResponse({
|
|||||||
toolCalls.push({
|
toolCalls.push({
|
||||||
...toolCall,
|
...toolCall,
|
||||||
id: toolId,
|
id: toolId,
|
||||||
|
type: 'function',
|
||||||
function: toolFunction,
|
function: toolFunction,
|
||||||
toolName: toolNode.name,
|
toolName: toolNode.name,
|
||||||
toolAvatar: toolNode.avatar
|
toolAvatar: toolNode.avatar
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user