mirror of
https://github.com/browser-use/web-ui.git
synced 2026-03-22 11:17:17 +08:00
feat: allow chrome cdp in env
This commit is contained in:
@@ -37,7 +37,7 @@ CHROME_DEBUGGING_PORT=9222
|
||||
CHROME_DEBUGGING_HOST=localhost
|
||||
# Set to true to keep browser open between AI tasks
|
||||
CHROME_PERSISTENT_SESSION=false
|
||||
|
||||
CHROME_CDP=http://localhost:9222
|
||||
# Display settings
|
||||
# Format: WIDTHxHEIGHTxDEPTH
|
||||
RESOLUTION=1920x1080x24
|
||||
|
||||
@@ -44,7 +44,9 @@ async def deep_research(task, llm, agent_state=None, **kwargs):
|
||||
|
||||
use_own_browser = kwargs.get("use_own_browser", False)
|
||||
extra_chromium_args = []
|
||||
cdp_url = None
|
||||
if use_own_browser:
|
||||
cdp_url = os.getenv("CHROME_CDP", None)
|
||||
# TODO: if use own browser, max query num must be 1 per iter, how to solve it?
|
||||
max_query_num = 1
|
||||
chrome_path = os.getenv("CHROME_PATH", None)
|
||||
@@ -57,6 +59,7 @@ async def deep_research(task, llm, agent_state=None, **kwargs):
|
||||
browser = CustomBrowser(
|
||||
config=BrowserConfig(
|
||||
headless=kwargs.get("headless", False),
|
||||
cdp_url=cdp_url,
|
||||
disable_security=kwargs.get("disable_security", True),
|
||||
chrome_instance_path=chrome_path,
|
||||
extra_chromium_args=extra_chromium_args,
|
||||
|
||||
16
webui.py
16
webui.py
@@ -282,7 +282,9 @@ async def run_org_agent(
|
||||
_global_agent_state.clear_stop()
|
||||
|
||||
extra_chromium_args = [f"--window-size={window_w},{window_h}"]
|
||||
cdp_url = None
|
||||
if use_own_browser:
|
||||
cdp_url = os.getenv("CHROME_CDP", None)
|
||||
chrome_path = os.getenv("CHROME_PATH", None)
|
||||
if chrome_path == "":
|
||||
chrome_path = None
|
||||
@@ -296,6 +298,7 @@ async def run_org_agent(
|
||||
_global_browser = Browser(
|
||||
config=BrowserConfig(
|
||||
headless=headless,
|
||||
cdp_url=cdp_url,
|
||||
disable_security=disable_security,
|
||||
chrome_instance_path=chrome_path,
|
||||
extra_chromium_args=extra_chromium_args,
|
||||
@@ -379,7 +382,10 @@ async def run_custom_agent(
|
||||
_global_agent_state.clear_stop()
|
||||
|
||||
extra_chromium_args = [f"--window-size={window_w},{window_h}"]
|
||||
cdp_url = None
|
||||
if use_own_browser:
|
||||
cdp_url = os.getenv("CHROME_CDP", None)
|
||||
|
||||
chrome_path = os.getenv("CHROME_PATH", None)
|
||||
if chrome_path == "":
|
||||
chrome_path = None
|
||||
@@ -397,6 +403,7 @@ async def run_custom_agent(
|
||||
config=BrowserConfig(
|
||||
headless=headless,
|
||||
disable_security=disable_security,
|
||||
cdp_url=cdp_url,
|
||||
chrome_instance_path=chrome_path,
|
||||
extra_chromium_args=extra_chromium_args,
|
||||
)
|
||||
@@ -854,6 +861,15 @@ def create_ui(config, theme_name="Ocean"):
|
||||
info="Browser window height",
|
||||
)
|
||||
|
||||
|
||||
save_recording_path = gr.Textbox(
|
||||
label="Recording Path",
|
||||
placeholder="e.g. ./tmp/record_videos",
|
||||
value=config['save_recording_path'],
|
||||
info="Path to save browser recordings",
|
||||
interactive=True, # Allow editing only if recording is enabled
|
||||
)
|
||||
|
||||
save_recording_path = gr.Textbox(
|
||||
label="Recording Path",
|
||||
placeholder="e.g. ./tmp/record_videos",
|
||||
|
||||
Reference in New Issue
Block a user