mirror of
https://github.com/stackblitz/bolt.new
synced 2024-11-27 22:42:21 +00:00
feat: add simple api error handling (#9)
This commit is contained in:
parent
2a3d5f569e
commit
7e31a6a700
@ -1,7 +1,7 @@
|
|||||||
import { useChat } from 'ai/react';
|
import { useChat } from 'ai/react';
|
||||||
import { useAnimate } from 'framer-motion';
|
import { useAnimate } from 'framer-motion';
|
||||||
import { useEffect, useRef, useState } from 'react';
|
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 { useMessageParser, usePromptEnhancer, useSnapScroll } from '~/lib/hooks';
|
||||||
import { chatStore } from '~/lib/stores/chat';
|
import { chatStore } from '~/lib/stores/chat';
|
||||||
import { workbenchStore } from '~/lib/stores/workbench';
|
import { workbenchStore } from '~/lib/stores/workbench';
|
||||||
@ -27,6 +27,7 @@ export function Chat() {
|
|||||||
api: '/api/chat',
|
api: '/api/chat',
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
logger.error(error);
|
logger.error(error);
|
||||||
|
toast.error('There was an error processing your request');
|
||||||
},
|
},
|
||||||
onFinish: () => {
|
onFinish: () => {
|
||||||
logger.debug('Finished streaming');
|
logger.debug('Finished streaming');
|
||||||
|
Loading…
Reference in New Issue
Block a user