mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-05-20 16:42:25 +00:00
fix(webui): accept end/error phases in backend transcript replay
Match the frontend fix: tool_trace_lines_from_events now processes end and error phases with call_id deduplication so transcript replay shows tool calls correctly. Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
parent
d7122a13d3
commit
c4794b82a9
@ -99,11 +99,17 @@ def tool_trace_lines_from_events(events: Any) -> list[str]:
|
|||||||
if not isinstance(events, list):
|
if not isinstance(events, list):
|
||||||
return []
|
return []
|
||||||
lines: list[str] = []
|
lines: list[str] = []
|
||||||
|
seen: set[str] = set()
|
||||||
for event in events:
|
for event in events:
|
||||||
if not event or not isinstance(event, dict):
|
if not event or not isinstance(event, dict):
|
||||||
continue
|
continue
|
||||||
if event.get("phase") != "start":
|
if event.get("phase") not in {"start", "end", "error"}:
|
||||||
continue
|
continue
|
||||||
|
call_id = event.get("call_id")
|
||||||
|
if call_id is not None and call_id in seen:
|
||||||
|
continue
|
||||||
|
if call_id is not None:
|
||||||
|
seen.add(call_id)
|
||||||
t = _format_tool_call_trace(event)
|
t = _format_tool_call_trace(event)
|
||||||
if t:
|
if t:
|
||||||
lines.append(t)
|
lines.append(t)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user