Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -140,9 +140,13 @@ with col2:
|
|
140 |
|
141 |
# Display chat messages from history on app rerun
|
142 |
for message in st.session_state.messages:
|
143 |
-
|
144 |
-
|
145 |
-
st.
|
|
|
|
|
|
|
|
|
146 |
|
147 |
|
148 |
def generate_chat_responses(chat_completion) -> Generator[str, None, None]:
|
|
|
140 |
|
141 |
# Display chat messages from history on app rerun
|
142 |
for message in st.session_state.messages:
|
143 |
+
if hasattr(message, "role"):
|
144 |
+
avatar = "🤖" if message.role == "assistant" else "🕺"
|
145 |
+
with st.chat_message(message.role, avatar=avatar):
|
146 |
+
st.markdown(message.content)
|
147 |
+
else:
|
148 |
+
st.warning("Message object does not have the 'role' attribute.")
|
149 |
+
|
150 |
|
151 |
|
152 |
def generate_chat_responses(chat_completion) -> Generator[str, None, None]:
|