소스 검색

hotfix openai function call tool_calls no index

lloydzhou 1 년 전
부모
커밋
3a969054e3
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      app/client/platforms/openai.ts

+ 1 - 1
app/client/platforms/openai.ts

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