ragflow icon indicating copy to clipboard operation
ragflow copied to clipboard

Fix: Prevent message sending when using IME composition

Open jabee0228 opened this issue 10 months ago • 4 comments

What problem does this PR solve?

This pull request addresses an issue where the "Enter" key would send the message prematurely while using Input Method Editor (IME) for text composition. This problem occurs when users are typing with a non-Latin input method, such as Chinese(Zhuyin), and press "Enter" to confirm their selection, which unintentionally triggers message submission.

Before:

https://github.com/user-attachments/assets/233f3ac9-4b4b-4424-b4ab-ea2e31bb0663

After:

https://github.com/user-attachments/assets/f1c01af6-d1d7-4a79-9e81-5bdf3c0b3529

Type of change

  • [x] Bug Fix (non-breaking change which fixes an issue)

jabee0228 avatar Feb 20 '25 08:02 jabee0228

You can consider using "sendLoading" directly to prevent triggering "enter" and causing the message to be sent again.

cike8899 avatar Feb 20 '25 09:02 cike8899

You can consider using "sendLoading" directly to prevent triggering "enter" and causing the message to be sent again.

I think you misunderstood the issue. The problem is that usually IME input method users need to press enter to confirm Chinese characters, so directly listening to enter will cause IME user to be unable to use it normally. Use isComposiong to wait until the user is using an IME. Does not affect English input.

jabee0228 avatar Feb 20 '25 10:02 jabee0228

Appreciation!

After this alteration, we discover that user can sent message continuely no matter the assistant is doing stream talking or not. That's innapropriate.

KevinHuSh avatar Feb 20 '25 10:02 KevinHuSh

Appreciation!

After this alteration, we discover that user can sent message continuely no matter the assistant is doing stream talking or not. That's innapropriate.

Yeah, you are right!

jabee0228 avatar Feb 20 '25 11:02 jabee0228

Appreciation!

After this alteration, we discover that user can sent message continuely no matter the assistant is doing stream talking or not. That's innapropriate.

Sorry for the confusion, but I’m not sure why my PR was canceled. I’ve fixed the issue that blocked new submissions while waiting for a response and have re-submitted a new PR at #5331 .

jabee0228 avatar Feb 25 '25 06:02 jabee0228