diff --git a/ui/desktop/src/components/BaseChat.tsx b/ui/desktop/src/components/BaseChat.tsx index 5ab30c7e09..25c38f2ea0 100644 --- a/ui/desktop/src/components/BaseChat.tsx +++ b/ui/desktop/src/components/BaseChat.tsx @@ -116,7 +116,7 @@ function BaseChatContent({ }); // Use shared file drop - const { droppedFiles, handleDrop, handleDragOver } = useFileDrop(); + const { droppedFiles, setDroppedFiles, handleDrop, handleDragOver } = useFileDrop(); // Use shared cost tracking const { sessionCosts } = useCostTracking({ @@ -290,6 +290,7 @@ function BaseChatContent({ inputTokens={sessionInputTokens || localInputTokens} outputTokens={sessionOutputTokens || localOutputTokens} droppedFiles={droppedFiles} + onFilesProcessed={() => setDroppedFiles([])} // Clear dropped files after processing messages={messages} setMessages={setMessages} disableAnimation={disableAnimation} diff --git a/ui/desktop/src/components/ChatInput.tsx b/ui/desktop/src/components/ChatInput.tsx index 86962ae688..f68982af42 100644 --- a/ui/desktop/src/components/ChatInput.tsx +++ b/ui/desktop/src/components/ChatInput.tsx @@ -50,6 +50,7 @@ interface ChatInputProps { commandHistory?: string[]; // Current chat's message history initialValue?: string; droppedFiles?: string[]; + onFilesProcessed?: () => void; // Callback to clear dropped files after processing setView: (view: View) => void; numTokens?: number; inputTokens?: number; @@ -73,6 +74,7 @@ export default function ChatInput({ commandHistory = [], initialValue = '', droppedFiles = [], + onFilesProcessed, setView, numTokens, inputTokens, @@ -646,6 +648,11 @@ export default function ChatInput({ setSavedInput(''); setIsInGlobalHistory(false); setHasUserTyped(false); + + // Clear dropped files after processing + if (onFilesProcessed && droppedFiles.length > 0) { + onFilesProcessed(); + } } };