Skip to content

Commit 8967be7

Browse files
author
katiue
committed
latest recording file display
1 parent 9956286 commit 8967be7

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

webui.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ async def run_browser_agent(
131131
if new_videos - existing_videos:
132132
latest_video = list(new_videos - existing_videos)[0] # Get the first new video
133133

134-
return final_result, errors, model_actions, model_thoughts, latest_video
134+
return final_result, errors, model_actions, model_thoughts, latest_video, trace_file
135135

136136
async def run_org_agent(
137137
llm,
@@ -292,7 +292,7 @@ async def run_custom_agent(
292292
recorded_files = get_latest_files(save_recording_path)
293293
trace_file = get_latest_files(save_trace_path)
294294

295-
return final_result, errors, model_actions, model_thoughts, trace_file.get('.webm'), recorded_files.get('.zip')
295+
return final_result, errors, model_actions, model_thoughts, recorded_files.get('.webm'), trace_file.get('.zip')
296296
except Exception as e:
297297
import traceback
298298
traceback.print_exc()
@@ -389,22 +389,22 @@ async def run_with_stream(
389389
# Initialize values for streaming
390390
html_content = "<div style='width:80vw; height:90vh'>Using browser...</div>"
391391
final_result = errors = model_actions = model_thoughts = ""
392-
recording = trace = None
392+
latest_videos = trace = None
393393

394394
# Periodically update the stream while the agent task is running
395395
while not agent_task.done():
396396
try:
397397
html_content = await capture_screenshot(_global_browser_context)
398398
except Exception as e:
399-
html_content = f"<div class='error' style='width:80vw; height:90vh'>Screenshot error: {str(e)}</div>"
399+
html_content = f"<div style='width:80vw; height:90vh'>Waiting for browser session...</div>"
400400

401401
yield [
402402
html_content,
403403
final_result,
404404
errors,
405405
model_actions,
406406
model_thoughts,
407-
recording,
407+
latest_videos,
408408
trace,
409409
]
410410
await asyncio.sleep(0.01)
@@ -413,7 +413,7 @@ async def run_with_stream(
413413
try:
414414
result = await agent_task
415415
if isinstance(result, tuple) and len(result) == 6:
416-
final_result, errors, model_actions, model_thoughts, recording, trace = agent_task
416+
final_result, errors, model_actions, model_thoughts, latest_videos, trace = result
417417
else:
418418
errors = "Unexpected result format from agent"
419419
except Exception as e:
@@ -425,14 +425,14 @@ async def run_with_stream(
425425
errors,
426426
model_actions,
427427
model_thoughts,
428-
recording,
428+
latest_videos,
429429
trace,
430430
]
431431

432432
except Exception as e:
433433
import traceback
434434
yield [
435-
f"<div class='error' style='width:80vw; height:90vh'>Browser error: {str(e)}</div>",
435+
f"<div style='width:80vw; height:90vh'>Waiting for browser session...</div>",
436436
"",
437437
f"Error: {str(e)}\n{traceback.format_exc()}",
438438
"",
@@ -745,13 +745,13 @@ def list_recordings(save_recording_path):
745745
enable_recording, task, add_infos, max_steps, use_vision, max_actions_per_step, tool_call_in_content
746746
],
747747
outputs=[
748-
browser_view,
749-
final_result_output,
750-
errors_output,
751-
model_actions_output,
752-
model_thoughts_output,
753-
recording_display,
754-
trace_file
748+
browser_view, # HTML view
749+
final_result_output, # Final result
750+
errors_output, # Errors
751+
model_actions_output, # Model actions
752+
model_thoughts_output, # Model thoughts
753+
recording_display, # Video file (.webm)
754+
trace_file # Trace file (.zip)
755755
],
756756
queue=True,
757757
)

0 commit comments

Comments
 (0)