Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -90,14 +90,13 @@ if prompt := st.chat_input("Type your message..."):
|
|
90 |
# Handle API response
|
91 |
if isinstance(output, list) and len(output) > 0 and 'generated_text' in output[0]:
|
92 |
assistant_response = output[0]['generated_text']
|
93 |
-
else:
|
94 |
-
st.error("Error: Unable to generate a response. Please try again.")
|
95 |
-
continue # Skip further execution for this iteration
|
96 |
|
97 |
-
|
98 |
-
|
99 |
|
100 |
-
|
|
|
|
|
101 |
|
102 |
except Exception as e:
|
103 |
-
st.error(f"Application Error: {str(e)}")
|
|
|
90 |
# Handle API response
|
91 |
if isinstance(output, list) and len(output) > 0 and 'generated_text' in output[0]:
|
92 |
assistant_response = output[0]['generated_text']
|
|
|
|
|
|
|
93 |
|
94 |
+
with st.chat_message("assistant"):
|
95 |
+
st.markdown(assistant_response)
|
96 |
|
97 |
+
st.session_state.messages.append({"role": "assistant", "content": assistant_response})
|
98 |
+
else:
|
99 |
+
st.error("Error: Unable to generate a response. Please try again.")
|
100 |
|
101 |
except Exception as e:
|
102 |
+
st.error(f"Application Error: {str(e)}")
|