Browse Source

Merge pull request #4379 from EasonQwQ/main

Fix: Handle empty server response in API call
fred-bf 1 year ago
parent
commit
f1b4c083a4
1 changed files with 3 additions and 0 deletions
  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;
           }