[X] I added a very descriptive title to this issue.
[X] I have provided sufficient information below to help reproduce this issue.
Summary
When dynamically updating the placeholder inside st.chat_input() messages can not send (premature rerun?). For example randomly choosing a placeholder causes the message to be lost.
Reproducible Code Example
import streamlit as st
import random
if user_input := st.chat_input(
random.choice(["say hi", "say hey", "say hello"]),
):
st.chat_message("user").markdown(user_input)
with st.chat_message("assistant"):
st.write("testing")
Steps To Reproduce
pip install streamlit
Copy the code sample above
streamlit run app.py
Expected Behavior
It appears to be a premature rerun, the code should display a new chat message but does not. Upon running the code it will be clear.
Current Behavior
It appears to be a premature rerun. The message simply seems to disappear.
Is this a regression?
[ ] Yes, this used to work in a previous version.
Debug info
Streamlit version: 1.38
Python version: 3.12.6
Operating System: Arch Linux
Browser: Firefox
Additional Information
Certainly not a critical bug, but given that streamlit is incredibly useful for LLM/Chat Apps it would be good to at least document.
Checklist
Summary
When dynamically updating the placeholder inside
st.chat_input()
messages can not send (premature rerun?). For example randomly choosing a placeholder causes the message to be lost.Reproducible Code Example
Steps To Reproduce
pip install streamlit
streamlit run app.py
Expected Behavior
It appears to be a premature rerun, the code should display a new chat message but does not. Upon running the code it will be clear.
Current Behavior
It appears to be a premature rerun. The message simply seems to disappear.
Is this a regression?
Debug info
Additional Information
Certainly not a critical bug, but given that streamlit is incredibly useful for LLM/Chat Apps it would be good to at least document.