Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -333,15 +333,18 @@ def stream_agent(question: str,
|
|
| 333 |
yield round_state["final_text"] or " ", round_state["summary_text"] or " ", "\n".join(log_lines[-400:])
|
| 334 |
|
| 335 |
# Log tool call argument deltas (optional)
|
| 336 |
-
elif etype in ("response.
|
| 337 |
delta = getattr(event, "delta", None)
|
| 338 |
if delta:
|
| 339 |
log_lines.append(str(delta))
|
|
|
|
|
|
|
| 340 |
|
| 341 |
# Capture tool RESULT text and try to parse indices
|
| 342 |
-
elif etype.startswith("response.
|
| 343 |
print("A tool output was detected")
|
| 344 |
-
|
|
|
|
| 345 |
if delta_text:
|
| 346 |
tool_result_buffer += str(delta_text)
|
| 347 |
parsed_now = _maybe_parse_indices(tool_result_buffer)
|
|
|
|
| 333 |
yield round_state["final_text"] or " ", round_state["summary_text"] or " ", "\n".join(log_lines[-400:])
|
| 334 |
|
| 335 |
# Log tool call argument deltas (optional)
|
| 336 |
+
elif etype in ("response.mcp_call_arguments.delta", "response.tool_call_arguments.delta"):
|
| 337 |
delta = getattr(event, "delta", None)
|
| 338 |
if delta:
|
| 339 |
log_lines.append(str(delta))
|
| 340 |
+
round_state["summary_text"] += "\nQuery call: " + event.delta + "\n"
|
| 341 |
+
yield round_state["final_text"] or " ", round_state["summary_text"] or " ", "\n".join(log_lines[-400:])
|
| 342 |
|
| 343 |
# Capture tool RESULT text and try to parse indices
|
| 344 |
+
elif etype.startswith("response.output_item.done"):
|
| 345 |
print("A tool output was detected")
|
| 346 |
+
print(event)
|
| 347 |
+
delta_text = getattr(event.item, "output", "")
|
| 348 |
if delta_text:
|
| 349 |
tool_result_buffer += str(delta_text)
|
| 350 |
parsed_now = _maybe_parse_indices(tool_result_buffer)
|