diff --git a/packages/ui/src/components/ChatInput.tsx b/packages/ui/src/components/ChatInput.tsx index 8d44db8..6ec317f 100644 --- a/packages/ui/src/components/ChatInput.tsx +++ b/packages/ui/src/components/ChatInput.tsx @@ -69,6 +69,7 @@ export function ChatInput({ const [selectedCommandIndex, setSelectedCommandIndex] = useState(0); const [showSystemCommandMenu, setShowSystemCommandMenu] = useState(false); const [selectedSystemCommandIndex, setSelectedSystemCommandIndex] = useState(0); + const [isComposing, setIsComposing] = useState(false); // IME 输入法组合状态 const textareaRef = useRef(null); // 命令系统 @@ -327,12 +328,22 @@ export function ChatInput({ } // Enter 发送,Shift+Enter 换行 - if (e.key === 'Enter' && !e.shiftKey) { + // 注意:IME 组合期间不发送(中文输入法按回车确认拼音) + if (e.key === 'Enter' && !e.shiftKey && !isComposing) { e.preventDefault(); handleSubmit(); } }; + // IME 输入法组合事件处理 + const handleCompositionStart = () => { + setIsComposing(true); + }; + + const handleCompositionEnd = () => { + setIsComposing(false); + }; + return (