| 841 | } |
| 842 | |
| 843 | const handleError = (message = 'Oops! There seems to be an error. Please try again.') => { |
| 844 | message = message.replace(`Unable to parse JSON response from chat agent.\n\n`, '') |
| 845 | setMessages((prevMessages) => [...prevMessages, { message, type: 'apiMessage' }]) |
| 846 | setLoading(false) |
| 847 | setUserInput('') |
| 848 | setUploadedFiles([]) |
| 849 | setTimeout(() => { |
| 850 | inputRef.current?.focus() |
| 851 | }, 100) |
| 852 | } |
| 853 | |
| 854 | const handlePromptClick = async (promptStarterInput) => { |
| 855 | setUserInput(promptStarterInput) |