diff --git a/src/frontend/src/modals/IOModal/components/chatView/chatInput/chat-input.tsx b/src/frontend/src/modals/IOModal/components/chatView/chatInput/chat-input.tsx index 435f231b1..08e466b10 100644 --- a/src/frontend/src/modals/IOModal/components/chatView/chatInput/chat-input.tsx +++ b/src/frontend/src/modals/IOModal/components/chatView/chatInput/chat-input.tsx @@ -166,18 +166,20 @@ export default function ChatInput({ const send = async () => { const storedChatValue = chatValue; + const filesToSend = files + .map((file) => file.path ?? "") + .filter((file) => file !== ""); + const storedFiles = [...files]; + setFiles([]); try { await sendMessage({ repeat: 1, - files: files - .map((file) => file.path ?? "") - .filter((file) => file !== ""), + files: filesToSend, }); } catch (error) { setChatValueStore(storedChatValue); + setFiles(storedFiles); } - - setFiles([]); }; const checkSendingOk = (event: React.KeyboardEvent) => { diff --git a/src/frontend/src/modals/IOModal/components/chatView/chatInput/components/no-input.tsx b/src/frontend/src/modals/IOModal/components/chatView/chatInput/components/no-input.tsx index a05add60a..bf690eb16 100644 --- a/src/frontend/src/modals/IOModal/components/chatView/chatInput/components/no-input.tsx +++ b/src/frontend/src/modals/IOModal/components/chatView/chatInput/components/no-input.tsx @@ -7,7 +7,7 @@ import { cn } from "../../../../../../utils/utils"; interface NoInputViewProps { isBuilding: boolean; - sendMessage: (args: { repeat: number }) => void; + sendMessage: (args: { repeat: number }) => Promise; stopBuilding: () => void; } @@ -23,8 +23,8 @@ const NoInputView: React.FC = ({