mirror of
https://github.com/browser-use/web-ui.git
synced 2026-03-22 11:17:17 +08:00
hotfix font error and stream error
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
browser-use==0.1.18
|
||||
browser-use==0.1.19
|
||||
langchain-google-genai==2.0.8
|
||||
pyperclip==1.9.0
|
||||
gradio==5.9.1
|
||||
|
||||
57
webui.py
57
webui.py
@@ -189,7 +189,7 @@ async def run_browser_agent(
|
||||
trace_file,
|
||||
history_file,
|
||||
gr.update(value="Stop", interactive=True), # Re-enable stop button
|
||||
gr.update(value="Run", interactive=True) # Re-enable run button
|
||||
gr.update(interactive=True) # Re-enable run button
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
@@ -205,7 +205,7 @@ async def run_browser_agent(
|
||||
None, # history_file
|
||||
None, # trace_file
|
||||
gr.update(value="Stop", interactive=True), # Re-enable stop button
|
||||
gr.update(value="Run", interactive=True) # Re-enable run button
|
||||
gr.update(interactive=True) # Re-enable run button
|
||||
)
|
||||
|
||||
|
||||
@@ -422,6 +422,7 @@ async def run_with_stream(
|
||||
max_actions_per_step,
|
||||
tool_call_in_content
|
||||
):
|
||||
global _global_agent_state
|
||||
stream_vw = 80
|
||||
stream_vh = int(80 * window_h // window_w)
|
||||
if not headless:
|
||||
@@ -454,6 +455,7 @@ async def run_with_stream(
|
||||
yield [html_content] + list(result)
|
||||
else:
|
||||
try:
|
||||
_global_agent_state.clear_stop()
|
||||
# Run the browser agent in the background
|
||||
agent_task = asyncio.create_task(
|
||||
run_browser_agent(
|
||||
@@ -485,7 +487,7 @@ async def run_with_stream(
|
||||
# Initialize values for streaming
|
||||
html_content = f"<h1 style='width:{stream_vw}vw; height:{stream_vh}vh'>Using browser...</h1>"
|
||||
final_result = errors = model_actions = model_thoughts = ""
|
||||
latest_videos = trace = None
|
||||
latest_videos = trace = history_file = None
|
||||
|
||||
|
||||
# Periodically update the stream while the agent task is running
|
||||
@@ -498,27 +500,40 @@ async def run_with_stream(
|
||||
html_content = f"<h1 style='width:{stream_vw}vw; height:{stream_vh}vh'>Waiting for browser session...</h1>"
|
||||
except Exception as e:
|
||||
html_content = f"<h1 style='width:{stream_vw}vw; height:{stream_vh}vh'>Waiting for browser session...</h1>"
|
||||
|
||||
yield [
|
||||
html_content,
|
||||
final_result,
|
||||
errors,
|
||||
model_actions,
|
||||
model_thoughts,
|
||||
latest_videos,
|
||||
trace,
|
||||
gr.update(value="Stop", interactive=True), # Re-enable stop button
|
||||
gr.update(value="Run", interactive=True) # Re-enable run button
|
||||
]
|
||||
|
||||
if _global_agent_state and _global_agent_state.is_stop_requested():
|
||||
yield [
|
||||
html_content,
|
||||
final_result,
|
||||
errors,
|
||||
model_actions,
|
||||
model_thoughts,
|
||||
latest_videos,
|
||||
trace,
|
||||
history_file,
|
||||
gr.update(value="Stopping...", interactive=False), # stop_button
|
||||
gr.update(interactive=False), # run_button
|
||||
]
|
||||
break
|
||||
else:
|
||||
yield [
|
||||
html_content,
|
||||
final_result,
|
||||
errors,
|
||||
model_actions,
|
||||
model_thoughts,
|
||||
latest_videos,
|
||||
trace,
|
||||
history_file,
|
||||
gr.update(value="Stop", interactive=True), # Re-enable stop button
|
||||
gr.update(interactive=True) # Re-enable run button
|
||||
]
|
||||
await asyncio.sleep(0.05)
|
||||
|
||||
# Once the agent task completes, get the results
|
||||
try:
|
||||
result = await agent_task
|
||||
if isinstance(result, tuple) and len(result) == 8:
|
||||
final_result, errors, model_actions, model_thoughts, latest_videos, trace, stop_button, run_button = result
|
||||
else:
|
||||
errors = "Unexpected result format from agent"
|
||||
final_result, errors, model_actions, model_thoughts, latest_videos, trace, history_file, stop_button, run_button = result
|
||||
except Exception as e:
|
||||
errors = f"Agent error: {str(e)}"
|
||||
|
||||
@@ -530,6 +545,7 @@ async def run_with_stream(
|
||||
model_thoughts,
|
||||
latest_videos,
|
||||
trace,
|
||||
history_file,
|
||||
stop_button,
|
||||
run_button
|
||||
]
|
||||
@@ -544,8 +560,9 @@ async def run_with_stream(
|
||||
"",
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
gr.update(value="Stop", interactive=True), # Re-enable stop button
|
||||
gr.update(value="Run", interactive=True) # Re-enable run button
|
||||
gr.update(interactive=True) # Re-enable run button
|
||||
]
|
||||
|
||||
# Define the theme map globally
|
||||
|
||||
Reference in New Issue
Block a user