From b7f7d25f549fc213b6dc63f17ea9204e41ba9806 Mon Sep 17 00:00:00 2001 From: ItzCrazyKns <95534749+ItzCrazyKns@users.noreply.github.com> Date: Tue, 7 Jan 2025 11:44:19 +0530 Subject: [PATCH] feat(chat-window): lint & beautify --- ui/components/ChatWindow.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ui/components/ChatWindow.tsx b/ui/components/ChatWindow.tsx index b6f1b30..ed3594c 100644 --- a/ui/components/ChatWindow.tsx +++ b/ui/components/ChatWindow.tsx @@ -73,7 +73,10 @@ const useSocket = ( }, }, ).then(async (res) => { - if (!res.ok) throw new Error(`Failed to fetch models: ${res.status} ${res.statusText}`); + if (!res.ok) + throw new Error( + `Failed to fetch models: ${res.status} ${res.statusText}`, + ); return res.json(); }); @@ -262,7 +265,6 @@ const useSocket = ( attemptReconnect(); } }; - } catch (error) { console.debug(new Date(), 'ws:error', error); attemptReconnect(); @@ -274,12 +276,17 @@ const useSocket = ( if (retryCountRef.current > MAX_RETRIES) { console.debug(new Date(), 'ws:max_retries'); setError(true); - toast.error('Unable to connect to server after multiple attempts. Please refresh the page to try again.'); + toast.error( + 'Unable to connect to server after multiple attempts. Please refresh the page to try again.', + ); return; } const backoffDelay = getBackoffDelay(retryCountRef.current); - console.debug(new Date(), `ws:retry attempt=${retryCountRef.current}/${MAX_RETRIES} delay=${backoffDelay}ms`); + console.debug( + new Date(), + `ws:retry attempt=${retryCountRef.current}/${MAX_RETRIES} delay=${backoffDelay}ms`, + ); if (reconnectTimeoutRef.current) { clearTimeout(reconnectTimeoutRef.current);