浏览代码

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;
           }