Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -63,18 +63,16 @@ if prompt := st.chat_input("Ask me a complex math question!"):
|
|
| 63 |
with st.chat_message("assistant"):
|
| 64 |
with st.spinner("Thinking..."):
|
| 65 |
try:
|
| 66 |
-
|
| 67 |
-
#
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
})
|
| 73 |
-
|
| 74 |
-
# Get the final response from the message list
|
| 75 |
final_answer = response["messages"][-1].content
|
| 76 |
|
| 77 |
st.markdown(final_answer)
|
| 78 |
st.session_state.messages.append({"role": "assistant", "content": final_answer})
|
|
|
|
| 79 |
except Exception as e:
|
| 80 |
st.error(f"An error occurred: {e}")
|
|
|
|
| 63 |
with st.chat_message("assistant"):
|
| 64 |
with st.spinner("Thinking..."):
|
| 65 |
try:
|
| 66 |
+
# ALL lines below 'try' must be indented 4 spaces further
|
| 67 |
+
# We pass the system_message rules directly here
|
| 68 |
+
response = agent_executor.invoke({
|
| 69 |
+
"messages": [system_message, ("user", prompt)]
|
| 70 |
+
})
|
| 71 |
+
|
|
|
|
|
|
|
|
|
|
| 72 |
final_answer = response["messages"][-1].content
|
| 73 |
|
| 74 |
st.markdown(final_answer)
|
| 75 |
st.session_state.messages.append({"role": "assistant", "content": final_answer})
|
| 76 |
+
|
| 77 |
except Exception as e:
|
| 78 |
st.error(f"An error occurred: {e}")
|