Skip to content

Commit 4b64685

Browse files
committed
refactor: remove agent history as a button and make it only a file in results tab
1 parent bbf9fea commit 4b64685

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

src/utils/utils.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,3 @@ async def capture_screenshot(browser_context):
200200
return encoded
201201
except Exception as e:
202202
return None
203-
204-
def download_agent_history(save_agent_history_path):
205-
history_file = os.path.join(save_agent_history_path, "AgentHistory.json")
206-
history_file = os.path.abspath(history_file) # Convert to absolute path
207-
if os.path.exists(history_file):
208-
return history_file
209-
else:
210-
return None

webui.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ async def run_browser_agent(
148148
tool_call_in_content=tool_call_in_content
149149
)
150150
elif agent_type == "custom":
151-
final_result, errors, model_actions, model_thoughts, trace_file = await run_custom_agent(
151+
final_result, errors, model_actions, model_thoughts, trace_file, history_file = await run_custom_agent(
152152
llm=llm,
153153
use_own_browser=use_own_browser,
154154
keep_browser_open=keep_browser_open,
@@ -186,6 +186,7 @@ async def run_browser_agent(
186186
model_thoughts,
187187
latest_video,
188188
trace_file,
189+
history_file,
189190
gr.update(value="Stop", interactive=True), # Re-enable stop button
190191
gr.update(value="Run", interactive=True) # Re-enable run button
191192
)
@@ -201,6 +202,7 @@ async def run_browser_agent(
201202
'', # model_thoughts
202203
None, # latest_video
203204
None, # trace_file
205+
None, # history_file
204206
gr.update(value="Stop", interactive=True), # Re-enable stop button
205207
gr.update(value="Run", interactive=True) # Re-enable run button
206208
)
@@ -374,7 +376,7 @@ async def run_custom_agent(
374376

375377
trace_file = get_latest_files(save_trace_path)
376378

377-
return final_result, errors, model_actions, model_thoughts, trace_file.get('.zip')
379+
return final_result, errors, model_actions, model_thoughts, trace_file.get('.zip'), history_file
378380
except Exception as e:
379381
import traceback
380382
traceback.print_exc()
@@ -794,13 +796,7 @@ def create_ui(theme_name="Ocean"):
794796

795797
trace_file = gr.File(label="Trace File")
796798

797-
history_download_button = gr.Button("⬇️ Download Agent History")
798-
799-
history_download_button.click(
800-
fn=utils.download_agent_history,
801-
inputs=save_agent_history_path,
802-
outputs=gr.File(),
803-
)
799+
agent_history_file = gr.File(label="Agent History")
804800

805801
# Bind the stop button click event after errors_output is defined
806802
stop_button.click(
@@ -826,6 +822,7 @@ def create_ui(theme_name="Ocean"):
826822
model_thoughts_output, # Model thoughts
827823
recording_display, # Latest recording
828824
trace_file, # Trace file
825+
agent_history_file, # Agent history file
829826
stop_button, # Stop button
830827
run_button # Run button
831828
],

0 commit comments

Comments
 (0)