wop commited on
Commit
ce37439
·
verified ·
1 Parent(s): bd30380

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -78,12 +78,9 @@ with col2:
78
 
79
  # Display chat messages from history on app rerun
80
  for message in st.session_state.messages:
81
- if hasattr(message, "role"):
82
- avatar = "🤖" if message.role == "assistant" else "🕺"
83
- with st.chat_message(message.role, avatar=avatar):
84
- st.markdown(message.content)
85
- else:
86
- st.warning("Message object does not have the 'role' attribute.")
87
 
88
  def generate_chat_responses(chat_completion) -> Generator[str, None, None]:
89
  """Yield chat response content from the Groq API response."""
 
78
 
79
  # Display chat messages from history on app rerun
80
  for message in st.session_state.messages:
81
+ avatar = "🤖" if message["role"] == "assistant" else "🕺"
82
+ with st.chat_message(message["role"], avatar=avatar):
83
+ st.markdown(message["content"])
 
 
 
84
 
85
  def generate_chat_responses(chat_completion) -> Generator[str, None, None]:
86
  """Yield chat response content from the Groq API response."""