Add chatbot messages to history (I think)
This commit is contained in:
parent
2169d321fb
commit
bf5cb6fb1b
7
app.py
7
app.py
@ -18,3 +18,10 @@ if prompt := st.chat_input("What is up?"):
|
||||
st.markdown(prompt)
|
||||
# Add user message to chat history
|
||||
st.session_state.messages.append({"role": "user", "content": prompt})
|
||||
|
||||
response = f"Echo: {prompt}"
|
||||
# Display assistant response in chat message container
|
||||
with st.chat_message("assistant"):
|
||||
st.markdown(response)
|
||||
# Add assistant response to chat history
|
||||
st.session_state.messages.append({"role": "assistant", "content": response})
|
Loading…
Reference in New Issue
Block a user