Skip to content

Commit

Permalink
feat: add simple api error handling (stackblitz-labs#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
connorff authored Jul 25, 2024
1 parent 2a3d5f5 commit 7e31a6a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/bolt/app/components/chat/Chat.client.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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');
Expand Down

0 comments on commit 7e31a6a

Please sign in to comment.