Chat input widget. (st.chat_input) Error Message

Hi, I am building a Streamlit set of tools on different pages of a main app. The main app and pages all have a sidebar. On the page that I intend to use as a Chat Bot, I receive an error message when trying to use the Chat Input Widget when I try to run the app locally.

I am using the latest Streamlit and Python versions. As I mentioned, there is a sidebar, but I am placing the st.chat_input box in the main page area. I removed all columns from that area, but still am receiving this error.

Is the st.chat_input not allowed in the main body area if there is a sidebar present on the page? I didn’t see any on this, but I’m hoping someone here can help me understand what I can do to maintain the sidebar while still taking advantage of this nice chat feature.

There is no problem using the following code in the main body:
with st.chat_message(“user”):
st.write(“Hello :wave:”)
st.line_chart(np.random.randn(30, 1))

Just when I try to use:
st.chat_input(“…”)

The error message I receive is:

line 308, in chat_input raise StreamlitAPIException(DISALLOWED_CONTAINERS_ERROR_TEXT)
streamlit.errors.StreamlitAPIException: st.chat_input() can’t be used inside an st.expander, st.form, st.tabs, st.columns, or st.sidebar.

Welcome to the vibrant Streamlit community! We’re excited to have you join us. For a smooth start, I recommend exploring our helpful thread Using Streamlit: How to Post a Question Effectively. This guide is a great way to learn how to frame your questions for clarity and effectiveness, ensuring you quickly find the answers and support you need from our enthusiastic and knowledgeable members.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.