Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: Prevent message sending during IME composition and block new submissions while waiting for a response (#5331)

James Chiang150ab9c6a4e6
diff --git a/web/src/components/message-input/index.tsx b/web/src/components/message-input/index.tsx
index 751c1f4a75..4f3de100d2 100644
--- a/web/src/components/message-input/index.tsx
+++ b/web/src/components/message-input/index.tsx
@@ -156,8 +156,14 @@ const MessageInput = ({
setFileList([]);
}, [fileList, onPressEnter, isUploadingFile]);
+ const [isComposing, setIsComposing] = useState(false);
+
+ const handleCompositionStart = () => setIsComposing(true);
+ const handleCompositionEnd = () => setIsComposing(false);
+
const handleInputKeyDown: KeyboardEventHandler<HTMLTextAreaElement> = (e) => {
if (e.key === 'Enter' && !e.nativeEvent.shiftKey) {
+ if (isComposing || sendLoading) return;
e.preventDefault();
handlePressEnter();
}
@@ -221,6 +227,8 @@ const MessageInput = ({
})}
onKeyDown={handleInputKeyDown}
onChange={onInputChange}
+ onCompositionStart={handleCompositionStart}
+ onCompositionEnd={handleCompositionEnd}
autoSize={{ minRows: 1, maxRows: 6 }}
/>
<Space>