MCPcopy Create free account
hub / github.com/admineral/OpenAI-Assistant-API-Chat / handleFormSubmit

Function handleFormSubmit

app/components/InputForm.tsx:30–50  ·  view source on GitHub ↗
(e: React.FormEvent<HTMLFormElement>)

Source from the content-addressed store, hash-verified

28
29const 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) {

Callers

nothing calls this directly

Calls 1

sendMessageMethod · 0.80

Tested by

no test coverage detected