소스 검색

Merge pull request #4379 from EasonQwQ/main

Fix: Handle empty server response in API call
fred-bf 1 년 전
부모
커밋
f1b4c083a4
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      app/client/platforms/openai.ts

+ 3 - 0
app/client/platforms/openai.ts

@@ -151,6 +151,9 @@ export class ChatGPTApi implements LLMApi {
           if (finished || controller.signal.aborted) {
             responseText += remainText;
             console.log("[Response Animation] finished");
+            if (responseText?.length === 0) {
+              options.onError?.(new Error("empty response from server"));
+            }
             return;
           }