-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow st.chat_input to be inside a container (i.e. have it above other elements) #7296
Comments
Yes! We are thinking about this and will probably start working on it in the next few months. No exact plan yet of how we'll make this work but will update here when we have a good idea. |
@jrieke checking in to see if you have an estimate date for this, or know whether it's not prioritized at the moment. Thank you! |
We're just about to start work on this. Don't have a concrete release date yet but should come out within the next ~3 months! |
thanks! |
That's great! Just encountered this problem aswell, so it'll help a lot. |
We have implemented support for using chat input inside containers. With the with st.container():
st.chat_input("Whats up?") Or: with st.expander("Chat inside expander"):
st.chat_input("Whats up?") This will display the chat_input inline instead of pinned to the bottom. |
To add on to that: we'll probably also introduce a parameter on |
Just curious if there's a planned release date for the 1.31 update? I'm currently developing a chatbot similar to OP and the ability to put chat_input into a container would greatly clean up the UI. Thanks! |
@bmeekers The release date is sometime next week. |
Really need the 1.31❤😭❤ |
@NahuelCostaCortez with the inline mode, it behaves like any other regular widget, e.g. import streamlit as st
with st.container():
# Create a placeholder container that holds all the messages:
messages = st.container(height=300)
if prompt := st.chat_input("Say something"):
messages.chat_message("user").write(prompt)
messages.chat_message("assistant").write(f"Echo: {prompt}") |
Thank you for the prompt reply. This works. However, when adding user-assistant interface the messages appear below the icon: This is the code:
Is there any way to solve this? Thank you in advance. |
Instead of |
Yeah, you´re right. Thanks for your help! |
Hey all, just wanted to update 1.31.0 is officially out! Check out the docs to learn how you can put chat features in containers, the side bar, tabs, expanders, the bottom of the page and more. Thanks again for your input and contributions, helping this feature become part of Streamlit.🥳 Looking forward to seeing all the new ways you’ll feature |
Checklist
Summary
Please allow us to be able to position the st.chat_input in different parts of the screen. Such as being part of a st.container or other layouts (columns, expanders). This will allow us to be able to position other elements below or around the chat_input and it won't be locked to the bottom of the main screen.
Why?
I want to be able to have a chat element at the top of a page, with a form underneath it as a feedback form. And currently the only way to do this is by injecting javascript code to move elements by id. And this gets harry very quickly trying to make sure this looks good on all devices (plus we have to run the javascript after the elements are created causing the initial load of the page to sometimes glitch).
Here's an example of what I'd like to be able to produce:
Allowing the st.messages to be a scrollable window, but the st.chat_input and st.form to be static on the bottom of the page.
How?
Don't lock st.chat_input to the bottom of the screen, but to the bottom of whatever container (or layer element) it's inside of. This way when we render st.container(s) after it those elements are actually blow them on the page.
Additional Context
Here's how I'm currently getting around this. (And I know this could be prettier):
The text was updated successfully, but these errors were encountered: