refactor(browser): migrate browser config to use BrowserProfile API

This commit is contained in:
nafer committed 2026-03-05 22:51:58 +03:00
1 parent 0fab25c80f
commit b35b66ad90
2 files changed
+5 -6

No files matched your search

Binary file not shown.
+5 -6
View File
@@ -7,9 +7,8 @@ import asyncio
from typing import Optional
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
from browser_use import Agent, Browser, ChatOpenAI
from browser_use import Agent, Browser, BrowserProfile, ChatOpenAI
from browser_use.agent.views import AgentHistoryList
from browser_use.browser.context import BrowserContextConfig, BrowserConfig
import uvicorn
from fastapi.responses import HTMLResponse
@@ -72,8 +71,8 @@ async def run_browser_task(task_id: str, task: str, max_steps: int, model: str):
api_key=api_key
)
# Настройки браузера
browser_config = BrowserConfig(
# Настройки браузера через BrowserProfile
browser_profile = BrowserProfile(
user_data_dir="/app/browser-data",
profile_directory="Default",
headless=True,
@@ -81,12 +80,12 @@ async def run_browser_task(task_id: str, task: str, max_steps: int, model: str):
# Добавляем remote debugging если включено
if REMOTE_DEBUGGING_ENABLED:
browser_config.extra_chromium_args = [
browser_profile.extra_chromium_args = [
f"--remote-debugging-port={REMOTE_DEBUGGING_PORT}",
"--remote-debugging-address=0.0.0.0"
]
browser = Browser(config=browser_config)
browser = Browser(browser_profile=browser_profile)
# Создание агента
agent = Agent(