diff --git a/src/App.tsx b/src/App.tsx index 63058c5a..37912f5f 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -151,18 +151,13 @@ export const App = () => { messageStore, ) .catch((error) => { - let errorMessage = + const errorMessage = typeof error === 'object' && error !== null && 'message' in error ? (error as { message: string }).message : 'An error occurred - please try again'; - // Errors can be thrown when recursive call is cancelled - if (errorMessage.includes('JSON')) { - errorMessage = 'You clicked cancel - please try again'; - } - setErrorText(errorMessage); }) .finally(() => { diff --git a/src/ChatView.tsx b/src/ChatView.tsx index 8caece80..bad8226a 100644 --- a/src/ChatView.tsx +++ b/src/ChatView.tsx @@ -62,15 +62,7 @@ export const ChatView = ({ ); const handleButtonClick = useCallback(() => { - const lastMessage = messages[messages.length - 1]; - const lastMessageRole = lastMessage.role; - - // if a user has initiated a wallet-based tool call, but not confirmed or denied it - // we don't want to add more messages to the history - const userRequestInProgress = - messages.length > 1 && lastMessageRole === 'user'; - - if (isRequesting || userRequestInProgress) { + if (isRequesting) { onCancel(); return; } @@ -90,7 +82,7 @@ export const ChatView = ({ onSubmit(output); setInputValue(''); - }, [messages, isRequesting, inputValue, onSubmit, onCancel]); + }, [isRequesting, inputValue, onSubmit, onCancel]); const buttonRef = useRef(null); const handleKeyDown = (event: React.KeyboardEvent) => {