Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -26,16 +26,13 @@ for msg in msgs.messages:
|
|
26 |
st.chat_message(msg.type).write(msg.content)
|
27 |
|
28 |
if prompt := st.chat_input():
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
st.error("No valid response received from the AI.")
|
40 |
-
except:
|
41 |
-
return "Something went wrong (:"
|
|
|
26 |
st.chat_message(msg.type).write(msg.content)
|
27 |
|
28 |
if prompt := st.chat_input():
|
29 |
+
st.chat_message("human").write(prompt)
|
30 |
+
msgs.add_user_message(prompt)
|
31 |
+
|
32 |
+
with st.spinner("Waiting for response..."):
|
33 |
+
res = get_prompt(prompt, api)
|
34 |
+
if res:
|
35 |
+
st.chat_message("ai").write(res)
|
36 |
+
msgs.add_ai_message(res)
|
37 |
+
else:
|
38 |
+
st.error("No valid response received from the AI.")
|
|
|
|
|
|