(e: React.FormEvent<HTMLFormElement>)
| 28 | |
| 29 | const InputForm: React.FC<Props> = ({ input, setInput, inputRef, formRef, disabled, chatStarted, isSending, isLoading, chatUploadedFiles, setChatUploadedFiles, chatFileDetails, setChatFileDetails, chatManager, setChatStarted, setChatMessages, setStatusMessage, setIsSending, setProgress, setIsLoadingFirstMessage }) => { |
| 30 | const handleFormSubmit = async (e: React.FormEvent<HTMLFormElement>) => { |
| 31 | e.preventDefault(); |
| 32 | if (isSending) { |
| 33 | return; |
| 34 | } |
| 35 | const message = input; |
| 36 | setInput(''); |
| 37 | setIsSending(true); |
| 38 | if (chatManager) { |
| 39 | const currentFiles = chatUploadedFiles; |
| 40 | setChatUploadedFiles([]); |
| 41 | setChatFileDetails([]); |
| 42 | try { |
| 43 | await chatManager.sendMessage(message, currentFiles, chatFileDetails); |
| 44 | } catch (error) { |
| 45 | console.error('Error sending message:', error); |
| 46 | } finally { |
| 47 | setIsSending(false); |
| 48 | } |
| 49 | } |
| 50 | }; |
| 51 | |
| 52 | const handleChatFilesUpload = (event: React.ChangeEvent<HTMLInputElement>) => { |
| 53 | if (event.target.files) { |
nothing calls this directly
no test coverage detected