Merge pull request #4379 from EasonQwQ/main

Fix: Handle empty server response in API call
This commit is contained in:
fred-bf 2024-03-24 14:18:14 +08:00 committed by GitHub
commit f1b4c083a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 0 deletions

View File

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