Skip to content

Commit

Permalink
Merge pull request #4268 from cuhong/fix/cjk-input-issue
Browse files Browse the repository at this point in the history
Fix: Fix issue with duplicate events on Enter key press during CJK character composition in chat input
  • Loading branch information
louis-jan authored Dec 17, 2024
2 parents 5fc04e0 + 294d7ec commit c166f7c
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,11 @@ const RichTextEditor = ({

const handleKeyDown = useCallback(
(event: React.KeyboardEvent) => {
if (event.key === 'Enter' && !event.shiftKey) {
if (
event.key === 'Enter' &&
!event.shiftKey &&
event.nativeEvent.isComposing === false
) {
event.preventDefault()
if (messages[messages.length - 1]?.status !== MessageStatus.Pending) {
sendChatMessage(currentPrompt)
Expand Down

0 comments on commit c166f7c

Please sign in to comment.