This commit is contained in:
nafer committed 2026-03-06 00:05:58 +03:00
1 parent 60eebf162a
commit 8c68bd8962
2 files changed
+13 -8

No files matched your search

Binary file not shown.
+13 -8
View File
@@ -78,26 +78,30 @@ async def run_browser_task(task_id: str, task: str, max_steps: int, model: str):
# Если включен remote debugging - запускаем Chrome вручную и подключаемся через CDP # Если включен remote debugging - запускаем Chrome вручную и подключаемся через CDP
if REMOTE_DEBUGGING_ENABLED: if REMOTE_DEBUGGING_ENABLED:
import subprocess import subprocess
import glob
# Ищем chromium в типичных местах # Ищем chromium в типичных местах (включая ms-playwright)
chromium_paths = [ chromium_search_paths = [
"/ms-playwright/chromium/chrome-linux/chrome", "/ms-playwright/chromium-*/chrome-linux/chrome",
"/root/.cache/ms-playwright/chromium-*/chrome-linux/chrome",
"/usr/bin/chromium", "/usr/bin/chromium",
"/usr/bin/chromium-browser", "/usr/bin/chromium-browser",
"/usr/bin/google-chrome", "/usr/bin/google-chrome",
] ]
chrome_exe = None chrome_exe = None
for path in chromium_paths: for pattern in chromium_search_paths:
if os.path.exists(path): matches = glob.glob(pattern)
chrome_exe = path if matches:
chrome_exe = matches[0] # Берем первый найденный
break break
if not chrome_exe: if not chrome_exe:
raise RuntimeError("Chrome/Chromium not found in container") raise RuntimeError(f"Chrome/Chromium not found. Searched: {chromium_search_paths}")
# Создаем временную директорию для профиля # Создаем директорию для профиля
user_data_dir = "/app/browser-data" user_data_dir = "/app/browser-data"
os.makedirs(user_data_dir, exist_ok=True)
# Запускаем Chrome с remote debugging # Запускаем Chrome с remote debugging
chrome_cmd = [ chrome_cmd = [
@@ -111,6 +115,7 @@ async def run_browser_task(task_id: str, task: str, max_steps: int, model: str):
"--disable-gpu", "--disable-gpu",
"--no-sandbox", "--no-sandbox",
"--disable-dev-shm-usage", "--disable-dev-shm-usage",
"--headless=new",
"about:blank" "about:blank"
] ]