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

+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
if REMOTE_DEBUGGING_ENABLED:
import subprocess
import glob
# Ищем chromium в типичных местах
chromium_paths = [
"/ms-playwright/chromium/chrome-linux/chrome",
# Ищем chromium в типичных местах (включая ms-playwright)
chromium_search_paths = [
"/ms-playwright/chromium-*/chrome-linux/chrome",
"/root/.cache/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
for pattern in chromium_search_paths:
matches = glob.glob(pattern)
if matches:
chrome_exe = matches[0] # Берем первый найденный
break
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"
os.makedirs(user_data_dir, exist_ok=True)
# Запускаем Chrome с remote debugging
chrome_cmd = [
@@ -111,6 +115,7 @@ async def run_browser_task(task_id: str, task: str, max_steps: int, model: str):
"--disable-gpu",
"--no-sandbox",
"--disable-dev-shm-usage",
"--headless=new",
"about:blank"
]