handle enter key in cjk input method (#2657)

Co-authored-by: zhhanging <hang@mindrank.ai>
This commit is contained in:
zhhanging 2024-04-09 22:50:15 +08:00 committed by GitHub
parent 5fd6025175
commit 5a9c63a776
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -99,7 +99,7 @@ const ChatInput: React.FC = () => {
}, [currentPrompt])
const onKeyDown = async (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
if (e.key === 'Enter' && !e.shiftKey) {
if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing) {
e.preventDefault()
if (messages[messages.length - 1]?.status !== MessageStatus.Pending)
sendChatMessage(currentPrompt)