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 inline usage of st.chat_input
#7896
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proto changes LGTM
st.chat_input
* Add initial version of inline chat input * Adapt python test * Fix tests * Fix tests * Fix tests * Fix tests * Remove unused import * Remove e2e tests * Fix test id names * Improve playwright conftest * Format conftest * Update tests * Fix unembedded iframe * Update snapshots * Add e2e test script * Add e2e tests * Add updated snapshots * Finalize test * Revert toast change * Fixes and improvements * Add missing snapshots * Update snapshots * Fix observer effect * Fix flickering effects * Fix typo * Fix comments * Fix test * Remove position parameter from API * Update example * Fix unit tests
Is it possible to share the source code of the demo file? It will be really useful for reference. I am trying to add a chat_input() within tabs and the chat_input() keeps moving up. |
You need to put the new messages into a container that is above the import streamlit as st
with st.sidebar:
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}") |
Describe your changes
This PR enables
st.chat_input
to be usedinline
in addition to the usage pinned to the bottom of the app. This is activated if thechat_input
is nested with any other layout container (e.g.st.container
,st.columns
,st.expander
,st.sidebar
):Demo: https://inline-chat-input-demo.streamlit.app/
GitHub Issue Link (if applicable)
Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.