Pārlūkot izejas kodu

Fix: Handle empty server response in API call

kidv 1 gadu atpakaļ
vecāks
revīzija
29e03b88c7
1 mainītis faili ar 3 papildinājumiem un 0 dzēšanām
  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;
           }