diff --git a/__pycache__/app.cpython-312.pyc b/__pycache__/app.cpython-312.pyc index e32d5ec..5711d0d 100644 Binary files a/__pycache__/app.cpython-312.pyc and b/__pycache__/app.cpython-312.pyc differ diff --git a/app.py b/app.py index 67a0fb7..86475fd 100644 --- a/app.py +++ b/app.py @@ -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" ]