How do i put buttons under st chat input in streamlit?

Summary

it seems like there is a bug with the new chat features where when I try to add buttons under chat input it just gets layered in a strange way

Steps to reproduce

Code snippet:

  if prompt := st.chat_input("What would you like to know about this document?"):
         ## code
           
        with col_9 :
            rerun = st.button('Re-run',help="this button will delete your chat history and prompt you to create a new one")
            if rerun:
                st.session_state.history=[]
                st.session_state.chat_his=[]
                st.session_state.messages=[]
                st.experimental_rerun()

1 Like

Hi @tarek-kerbedj

Could you help to provide more information on what is the expected or desired output of the rerun, if it is to reset the app, could you try experimenting with unindenting the if rerun statements to be independent of the prompt statement.

1 Like

Hey @dataprofessor Thank your for assistance
the expected output is having the buttons BELOW the text box
it works fine using third-party implementation st_chat
i have tried unindenting and it’s still always on top, no matter where I put it in the code

1 Like

I had a need for buttons in a chat program. I decided to go with buttons in the sidebar instead of bottom of conversation area. ChatGPT Style Example SOTA

1 Like

@dataprofessor,

Has this issue been resolved? I’m experiencing a similar problem as well.
I need to place buttons below the prompt.

2 Likes

The issue still persists.
The feature to add more buttons to the chat_input would solve both my and @tarek-kerbedj 's problem

2 Likes

The issue still persists.
It will be much more useful to have more buttons to chat input

1 Like

Having the same issue where buttons to provide feedback or reset chat are above the chat input

1 Like

You may find this useful:

1 Like

Hi, has anyone found a solution yet? I have a similar use case and I want to put a button below the st.chat_input widget.

    st.chat_input(placeholder="Enter your message", key="user_message", on_submit=chat_input_callback)
    st.markdown("***")
    #!! Accept voice input
    if st.button("Toggle mic input"):
        if st.session_state.mic_toggle:
            process_input_message(st.session_state.mic_prompt, insert_sample)
            st.session_state.mic_prompt = ""

        st.session_state.mic_toggle = not(st.session_state.mic_toggle)

    # Show device list of microphones in streamlit
    selected_mic = st.selectbox("Select device", sr.Microphone.list_microphone_names())
    selected_mic_index = sr.Microphone.list_microphone_names().index(selected_mic)

As you can see in the code, the st.chat_input widget is called first and before the markdown and the ‘Toggle mic input’ button. However, this is how it looks like upon running:

1 Like

hi @dataprofessor / Anyone , is their any help on how to place the button’s after the chat input, still on latest version 1.28.2 it is showing on the top.

Any help would be really appreciated and thanks

1 Like

Has there been any progress on this?

1 Like

I believe that you can now put the chat input into st.containers and move those around the page as you want.

3 Likes