From 7e31a6a700a59186e97a3dcf96402b41c77428a6 Mon Sep 17 00:00:00 2001 From: Connor Fogarty <40175891+connorff@users.noreply.github.com> Date: Thu, 25 Jul 2024 01:16:16 -0500 Subject: [PATCH] feat: add simple api error handling (#9) --- packages/bolt/app/components/chat/Chat.client.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/bolt/app/components/chat/Chat.client.tsx b/packages/bolt/app/components/chat/Chat.client.tsx index 47518bd..346a0fe 100644 --- a/packages/bolt/app/components/chat/Chat.client.tsx +++ b/packages/bolt/app/components/chat/Chat.client.tsx @@ -1,7 +1,7 @@ import { useChat } from 'ai/react'; import { useAnimate } from 'framer-motion'; import { useEffect, useRef, useState } from 'react'; -import { ToastContainer, cssTransition } from 'react-toastify'; +import { toast, ToastContainer, cssTransition } from 'react-toastify'; import { useMessageParser, usePromptEnhancer, useSnapScroll } from '~/lib/hooks'; import { chatStore } from '~/lib/stores/chat'; import { workbenchStore } from '~/lib/stores/workbench'; @@ -27,6 +27,7 @@ export function Chat() { api: '/api/chat', onError: (error) => { logger.error(error); + toast.error('There was an error processing your request'); }, onFinish: () => { logger.debug('Finished streaming');