Fix: Prevent message sending when using IME composition
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)
You can consider using "sendLoading" directly to prevent triggering "enter" and causing the message to be sent again.
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.
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.
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!
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 .