Skip to content
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

classic chat interface #31

Open
pavlozt opened this issue Apr 29, 2023 · 3 comments
Open

classic chat interface #31

pavlozt opened this issue Apr 29, 2023 · 3 comments

Comments

@pavlozt
Copy link

pavlozt commented Apr 29, 2023

Could you change the example to a classic chat interface in example program?
Message history at the top, buttons at the bottom, the new message is empty and is added at the bottom on the first submit.

I understand that the example is made to magically solve a difficult streamlit problems: the inability to display not yet existing variables. But since you set the tone for many novice programmers, could you remake the example?

Another confirmation that people need it is here - #17

@Skrattoune
Copy link

That's my problem actually.
I want to display history chronologically and have the input box in the bottom.

The screenshot provided corresponds to my use case, but all the examples i was able to find are doing the opposite.

Could someone provide an example?

@mgardner-chegg
Copy link

mgardner-chegg commented May 15, 2023

@pavlozt and @Skrattoune in the example you can choose the order you want. You probably want something like this:

if st.session_state["generated"]:
    for i in range(0, len(st.session_state["generated"]), 1):
        message(st.session_state["past"][i], is_user=True, key=str(i) + "_user")
        message(st.session_state["generated"][i], key=str(i))

@miguelp77
Copy link

miguelp77 commented Jun 12, 2023

Following this link we can fixed the input box at bottom

styl = f"""
<style>
    .stTextInput {{
      position: fixed;
      bottom: 3rem;
    }}
</style>
"""
st.markdown(styl, unsafe_allow_html=True)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants