Thanks for sharing this question. Can you edit your post to include a runnable code snippet? Itโs hard to say exactly whatโs going wrong without seeing what chat_summary() is doing.
A simpler way to create a chat history and display it when someone clicks a button would be the following:
At the beginning of your script, initialize the chat history:
if "messages" not in st.session_state:
st.session_state.messages = []
After the user enters a message, append that message to the message history: