diff --git a/src/renderer/src/components/MessageInput.tsx b/src/renderer/src/components/MessageInput.tsx index 14dbc4ddae..6312962ff5 100644 --- a/src/renderer/src/components/MessageInput.tsx +++ b/src/renderer/src/components/MessageInput.tsx @@ -2,6 +2,7 @@ * Message input component */ import { useState, useRef, useEffect } from 'react' +import { ArrowUp, Square } from 'lucide-react' import { Button } from '@/components/ui/button' interface MessageInputProps { @@ -20,6 +21,7 @@ export function MessageInput({ placeholder = 'Type a message...', }: MessageInputProps) { const [value, setValue] = useState('') + const [isComposing, setIsComposing] = useState(false) const textareaRef = useRef(null) // Auto-resize textarea @@ -45,40 +47,49 @@ export function MessageInput({ } const handleKeyDown = (e: React.KeyboardEvent) => { - if (e.key === 'Enter' && !e.shiftKey) { + // Don't submit while IME is composing + if (e.key === 'Enter' && !e.shiftKey && !isComposing) { e.preventDefault() handleSubmit() } } + const canSubmit = !disabled && value.trim().length > 0 + return ( -
-
-