hotfix openai function call tool_calls no index

This commit is contained in:
lloydzhou 2024-09-22 18:59:49 +08:00
parent 4d1f9e49d4
commit 3a969054e3
1 changed files with 1 additions and 1 deletions

View File

@ -303,10 +303,10 @@ export class ChatGPTApi implements LLMApi {
}>; }>;
const tool_calls = choices[0]?.delta?.tool_calls; const tool_calls = choices[0]?.delta?.tool_calls;
if (tool_calls?.length > 0) { if (tool_calls?.length > 0) {
index += 1;
const id = tool_calls[0]?.id; const id = tool_calls[0]?.id;
const args = tool_calls[0]?.function?.arguments; const args = tool_calls[0]?.function?.arguments;
if (id) { if (id) {
index += 1;
runTools.push({ runTools.push({
id, id,
type: tool_calls[0]?.type, type: tool_calls[0]?.type,