Spestly commited on
Commit
b3231d0
·
verified ·
1 Parent(s): 49eb3aa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
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") and hasattr(response.message.content, "text"):
109
- reply = response.message.content.text
 
110
  else:
111
  st.write(response)
112
- reply = "❗️Couldn't find response.message.content.text in the Cohere response."
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})