From 230dbf0d409a7498a86987d6e074fc1c39b2eaf8 Mon Sep 17 00:00:00 2001 From: ngocanhnt269 Date: Mon, 4 Aug 2025 21:27:37 -0700 Subject: [PATCH] Fixed unresponsive user response button --- src/webui/components/browser_use_agent_tab.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/webui/components/browser_use_agent_tab.py b/src/webui/components/browser_use_agent_tab.py index a488e70..b51a166 100644 --- a/src/webui/components/browser_use_agent_tab.py +++ b/src/webui/components/browser_use_agent_tab.py @@ -632,11 +632,8 @@ async def run_agent_task( last_chat_len = len(webui_manager.bu_chat_history) yield update_dict # Wait until response is submitted or task finishes - while ( - webui_manager.bu_response_event is not None - and not agent_task.done() - ): - await asyncio.sleep(0.2) + await webui_manager.bu_response_event.wait() + # Restore UI after response submitted or if task ended unexpectedly if not agent_task.done(): yield { @@ -1071,7 +1068,7 @@ def create_browser_use_agent_tab(webui_manager: WebuiManager): # --- Connect Event Handlers using the Wrappers -- run_button.click( - fn=submit_wrapper, inputs=all_managed_components, outputs=run_tab_outputs + fn=submit_wrapper, inputs=all_managed_components, outputs=run_tab_outputs, trigger_mode="multiple" ) user_input.submit( fn=submit_wrapper, inputs=all_managed_components, outputs=run_tab_outputs