Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -105,11 +105,12 @@ if prompt := st.chat_input("Message..."):
|
|
| 105 |
model=selected_model,
|
| 106 |
messages=st.session_state.messages
|
| 107 |
)
|
| 108 |
-
if hasattr(response, "message") and hasattr(response.message, "content")
|
| 109 |
-
|
|
|
|
| 110 |
else:
|
| 111 |
st.write(response)
|
| 112 |
-
reply = "❗️Couldn't
|
| 113 |
st.markdown(reply)
|
| 114 |
|
| 115 |
st.session_state.messages.append({"role": "assistant", "content": reply})
|
|
|
|
| 105 |
model=selected_model,
|
| 106 |
messages=st.session_state.messages
|
| 107 |
)
|
| 108 |
+
if hasattr(response, "message") and hasattr(response.message, "content"):
|
| 109 |
+
content_items = response.message.content
|
| 110 |
+
reply = "".join(getattr(item, 'text', '') for item in content_items)
|
| 111 |
else:
|
| 112 |
st.write(response)
|
| 113 |
+
reply = "❗️Couldn't extract reply from the Cohere response."
|
| 114 |
st.markdown(reply)
|
| 115 |
|
| 116 |
st.session_state.messages.append({"role": "assistant", "content": reply})
|