From 8f66e44162f82859c35aea79ced52b47e98bbdb4 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 9 Dec 2025 13:29:51 -0600 Subject: [PATCH] Improve APIConnectionError in Quilly --- src/components/Quilly.tsx | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/components/Quilly.tsx b/src/components/Quilly.tsx index b7f275b4..66006a58 100644 --- a/src/components/Quilly.tsx +++ b/src/components/Quilly.tsx @@ -1,4 +1,4 @@ -import { APIError } from 'openai'; +import { APIConnectionError, APIError } from 'openai'; import { useNavigate } from 'react-router-dom'; import { X } from 'lucide-react'; import { Button } from '@/components/ui/button'; @@ -183,15 +183,22 @@ function QuillyContent({ error, onDismiss, onNewChat, onOpenModelSelector, onTry message: 'The AI service is temporarily unavailable. Please try again in a moment.', actions: [], }; - - default: - return { - message: `AI service error: ${error.message}`, - actions: [], - }; } } + if (error instanceof APIConnectionError) { + return { + message: 'Network error: Unable to reach AI service. Please check your internet connection and try again.', + actions: onTryAgain ? [{ + label: 'Try again', + onClick: () => { + onTryAgain(); + onDismiss(); + }, + }] : [], + }; + } + // Default fallback return { message: error.message