From 0ee3f02d63223665018f1224ddf0101111960839 Mon Sep 17 00:00:00 2001 From: kejun Date: Thu, 23 Mar 2023 18:01:26 +0800 Subject: [PATCH] fix: simple network error result --- composables/useChatGPT.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/composables/useChatGPT.ts b/composables/useChatGPT.ts index 8d81532..5ae35c5 100644 --- a/composables/useChatGPT.ts +++ b/composables/useChatGPT.ts @@ -97,7 +97,11 @@ export const useChatGPT = createSharedComposable(() => { resp = (await createFetchGPTResponse(options, messages, signal)) as any; } catch (error: any) { isError = true; - resp = error.data; + if (error.data) { + resp = error.data; + } else { + throw error; + } } const parser = createParser((event) => { if (event.type === "event") {