The st.chat_input of streamlit is very good. However, in multilingual input, such as Chinese, if you input English, it is customary to use “enter”, but it will be submitted directly instead of confirming the input content. Can it be solved, or does streamlit need it? Pay attention to this problem in the new version
Steps to reproduce
add code here
If applicable, please provide the steps we should take to reproduce the error or specified behavior.
Explain what you expect to happen when you run the code above.
Explain the undesired behavior or error you see when you run the code above.
If you’re seeing an error message, share the full contents of the error message here.
- Streamlit version: (get it with
$ streamlit version)
- Python version: (get it with
$ python --version)
- Using Conda? PipEnv? PyEnv? Pex?
- OS version:
- Browser version:
Using Conda? PipEnv? PyEnv? Pex? Share the contents of your requirements file here.
Not sure what a requirements file is? Check out this doc and add a requirements file to your app.
- Link to your GitHub repo:
- Link to your deployed app:
If needed, add any other context about the problem here.
st.chat_input provides a
on_submit callback parameter that allows you to perform additional processing of the input prompt by embedding those statements in a custom callback function.
More details on the Docs page:
Hope this helps!
When you enter for the first time, in a multi-language environment, you choose to enter the content, and you should not submit it. The second time you enter is to submit.But I don’t know how to write this callback function
thank you very much. I will read it
it is diffculty to make it ,I don’t know how to code the callback
In general, when inputting Chinese words, you may need to select the candidate words and press the Enter key to confirm each word. Since chat_input will trigger submit when it detects enter, it will send out the current text before the user finishes the input. Perhaps an option can be provided to disable the trigger of submit when detecting the enter key, and instead trigger submit with the send key.
st.text_area work as expected or they have the same problem than
st.text_area seems work in right way, so I think st.chat should be improved
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.