Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -88,10 +88,17 @@ if st.button("Submit"):
|
|
| 88 |
messages = [HumanMessage(content=user_question)]
|
| 89 |
response = react_graph.invoke({"messages": messages})
|
| 90 |
|
| 91 |
-
# Display results
|
| 92 |
-
st.subheader("Responses")
|
| 93 |
for m in response['messages']:
|
| 94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
st.success("Processing complete!")
|
| 97 |
|
|
|
|
| 88 |
messages = [HumanMessage(content=user_question)]
|
| 89 |
response = react_graph.invoke({"messages": messages})
|
| 90 |
|
| 91 |
+
# Display results step-by-step like the original code
|
| 92 |
+
st.subheader("Responses:")
|
| 93 |
for m in response['messages']:
|
| 94 |
+
if hasattr(m, "content") and m.content: # Display human and assistant messages
|
| 95 |
+
st.write("**AI Message:**", m.content)
|
| 96 |
+
if hasattr(m, "tool_calls") and m.tool_calls: # Display tool call steps
|
| 97 |
+
for tool_call in m.tool_calls:
|
| 98 |
+
st.write(f"**Tool Call:** `{tool_call['name']}`")
|
| 99 |
+
st.json(tool_call['args']) # Display tool arguments in JSON
|
| 100 |
+
if "output" in tool_call: # Handle tool outputs if available
|
| 101 |
+
st.write("**Tool Output:**", tool_call['output'])
|
| 102 |
|
| 103 |
st.success("Processing complete!")
|
| 104 |
|