From 29e03b88c75355341859bf0b3e3c6c34699a34a9 Mon Sep 17 00:00:00 2001 From: kidv Date: Sun, 24 Mar 2024 04:07:25 +0800 Subject: [PATCH] Fix: Handle empty server response in API call --- app/client/platforms/openai.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/client/platforms/openai.ts b/app/client/platforms/openai.ts index 629158843c4..78e628ad771 100644 --- a/app/client/platforms/openai.ts +++ b/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; }