You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using IME to input Japanese prompts in the Chat LangChain (https://chat.langchain.com/), pressing the Enter key to confirm Japanese character conversion results in the prompt being prematurely sent. This issue likely affects other languages using IME as well. (The same type of issue as langchain-ai/langchain#24231, but the solution is slightly different)
Steps to Reproduce:
Use IME to input a Japanese prompt.
Press the Enter key to confirm character conversion.
Expected Behavior:
The input should be correctly converted to Japanese.
The prompt should not be sent.
Actual Behavior:
The prompt is sent prematurely while still being composed.
Proposed Solution:
In my local environment, running the following code in the Chrome console resolves the issue. I suggest incorporating a similar solution into the Chat LangChain:
(function(){'use strict';varparent_element=document.querySelector("body");varisComposing=false;// Start of Japanese inputparent_element.addEventListener('compositionstart',function(){if(event.target.tagName==='TEXTAREA'){isComposing=true;}});// End of Japanese inputparent_element.addEventListener('compositionend',function(){if(event.target.tagName==='TEXTAREA'){isComposing=false;}});// Modified handleIMEEnter functionfunctionhandleIMEEnter(event){if(event.target.tagName==='TEXTAREA'){if(event.code=="Enter"&&isComposing){event.stopPropagation();}}}// Register handleIMEEnter function as a keydown event listenerparent_element.addEventListener('keydown',handleIMEEnter);})();
Additional Notes:
The difference with IME Input Handling Issue in LangChain Chat Playground is that in Chat LangChain, a new TextArea is dynamically added for each prompt submission. Therefore, it is necessary to ensure that events are fired from the newly added TextArea as well. Specifically, this is achieved by capturing and handling events that bubble up to the body element.
System Information
OS: Darwin
OS Version: Darwin Kernel Version 21.6.0: Thu Jun 8 23:57:12 PDT 2023; root:xnu-8020.240.18.701.6~1/RELEASE_X86_64
Browser: Google Chrome Version 126.0.6478.127 (Official Build) (x86_64)
The text was updated successfully, but these errors were encountered:
Example Code
There is an issue at https://chat.langchain.com/
Description
When using IME to input Japanese prompts in the Chat LangChain (https://chat.langchain.com/), pressing the Enter key to confirm Japanese character conversion results in the prompt being prematurely sent. This issue likely affects other languages using IME as well. (The same type of issue as langchain-ai/langchain#24231, but the solution is slightly different)
Steps to Reproduce:
Use IME to input a Japanese prompt.
Press the Enter key to confirm character conversion.
Expected Behavior:
The input should be correctly converted to Japanese.
The prompt should not be sent.
Actual Behavior:
The prompt is sent prematurely while still being composed.
Proposed Solution:
In my local environment, running the following code in the Chrome console resolves the issue. I suggest incorporating a similar solution into the Chat LangChain:
Additional Notes:
The difference with IME Input Handling Issue in LangChain Chat Playground is that in Chat LangChain, a new TextArea is dynamically added for each prompt submission. Therefore, it is necessary to ensure that events are fired from the newly added TextArea as well. Specifically, this is achieved by capturing and handling events that bubble up to the body element.
System Information
The text was updated successfully, but these errors were encountered: