Fix: IME composition preventing message sending in chat

This commit is contained in:
Hidetaka Tsuji 2025-06-24 13:54:51 +02:00
parent b5a41840a0
commit b5ae6d7a96

View file

@ -1121,7 +1121,7 @@ const UserMessageComponent = ({ chatMessage, messageIdx, isCheckpointGhost, curr
if (e.key === 'Escape') {
onCloseEdit()
}
if (e.key === 'Enter' && !e.shiftKey) {
if (e.key === 'Enter' && !e.shiftKey && !(e.nativeEvent as any).isComposing) {
onSubmit()
}
}
@ -3048,7 +3048,7 @@ export const SidebarChat = () => {
setInstructionsAreEmpty(!newStr)
}, [setInstructionsAreEmpty])
const onKeyDown = useCallback((e: KeyboardEvent<HTMLTextAreaElement>) => {
if (e.key === 'Enter' && !e.shiftKey) {
if (e.key === 'Enter' && !e.shiftKey && !(e.nativeEvent as any).isComposing) {
onSubmit()
} else if (e.key === 'Escape' && isRunning) {
onAbort()