Fix: Handle empty server response in API call
This commit is contained in:
parent
ebbd870150
commit
29e03b88c7
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue