[Python] How to add autocomplete suggestions to st.chat_input() in Streamlit (like Google...

Discussão em 'Python' iniciado por Stack, Junho 10, 2025.

  1. Stack

    Stack Membro Participativo

    I want to show autocomplete suggestions while the user is typing — like Google Search. For example, when a user types "how", it should suggest things like: how it work, how to do and etc.

    # Chat input
    if query1 := st.chat_input("Ask Here", key="chat1"):
    with st.spinner("AI is analyzing ..."):
    try:
    st.chat_message("user").markdown(query1)
    st.session_state.sales_messages.append({"role": "user", "content": query1})
    # (AI response generation logic here)


    is there anyway I can add autocomplete to st.chat_input()?

    I'm okay using JavaScript or streamlit.components.v1 if needed.

    Continue reading...

Compartilhe esta Página