From 4728d426d81bc7e7535bd4ecde5b94eab6148b20 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Fri, 3 Nov 2023 19:30:03 -0700 Subject: [PATCH] fix: openai error message --- src/routes/+page.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index cd87cba3..06dd2925 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -378,10 +378,10 @@ }) .catch((error) => { console.log(error); - toast.error(`OpenAI: ${error.error.message}`); + toast.error(`OpenAI: ${error?.error?.message ?? 'Network Problem'}`); return null; }); - const openaiModels = openaiModelRes.data; + const openaiModels = openaiModelRes?.data ?? null; if (openaiModels) { models = [