ff
This commit is contained in:
1 parent
4e8160ae85
commit
f46e23b9a2
2 files changed
+20
-2
No files matched your search
Binary file not shown.
@@ -78,14 +78,31 @@ async def run_browser_task(task_id: str, task: str, max_steps: int, model: str):
|
||||
# Если включен remote debugging - запускаем Chrome вручную и подключаемся через CDP
|
||||
if REMOTE_DEBUGGING_ENABLED:
|
||||
import subprocess
|
||||
import tempfile
|
||||
import os
|
||||
|
||||
# Ищем chromium в типичных местах
|
||||
chromium_paths = [
|
||||
"/ms-playwright/chromium/chrome-linux/chrome",
|
||||
"/usr/bin/chromium",
|
||||
"/usr/bin/chromium-browser",
|
||||
"/usr/bin/google-chrome",
|
||||
]
|
||||
|
||||
chrome_exe = None
|
||||
for path in chromium_paths:
|
||||
if os.path.exists(path):
|
||||
chrome_exe = path
|
||||
break
|
||||
|
||||
if not chrome_exe:
|
||||
raise RuntimeError("Chrome/Chromium not found in container")
|
||||
|
||||
# Создаем временную директорию для профиля
|
||||
user_data_dir = "/app/browser-data"
|
||||
|
||||
# Запускаем Chrome с remote debugging
|
||||
chrome_cmd = [
|
||||
"chromium",
|
||||
chrome_exe,
|
||||
f"--remote-debugging-port={REMOTE_DEBUGGING_PORT}",
|
||||
f"--user-data-dir={user_data_dir}",
|
||||
"--no-first-run",
|
||||
@@ -94,6 +111,7 @@ async def run_browser_task(task_id: str, task: str, max_steps: int, model: str):
|
||||
"--disable-popup-blocking",
|
||||
"--disable-gpu",
|
||||
"--no-sandbox",
|
||||
"--disable-dev-shm-usage",
|
||||
"about:blank"
|
||||
]
|
||||
|
||||
|
||||
Reference in new issue
Block a user