Add chatbot messages to history (I think)
This commit is contained in:
		
							
								
								
									
										7
									
								
								app.py
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								app.py
									
									
									
									
									
								
							@@ -18,3 +18,10 @@ if prompt := st.chat_input("What is up?"):
 | 
				
			|||||||
        st.markdown(prompt)
 | 
					        st.markdown(prompt)
 | 
				
			||||||
    # Add user message to chat history
 | 
					    # Add user message to chat history
 | 
				
			||||||
    st.session_state.messages.append({"role": "user", "content": prompt})
 | 
					    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})
 | 
				
			||||||
		Reference in New Issue
	
	Block a user