diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..9635889 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +data +tmp \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 1fdeaca..0d635ac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -61,6 +61,7 @@ RUN pip install --no-cache-dir -r requirements.txt ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright RUN playwright install --with-deps chromium RUN playwright install-deps +RUN apt-get install -y google-chrome-stable # Copy the application code COPY . . diff --git a/docker-compose.yml b/docker-compose.yml index 6253a4a..864391b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,13 +28,9 @@ services: - RESOLUTION_WIDTH=${RESOLUTION_WIDTH:-1920} - RESOLUTION_HEIGHT=${RESOLUTION_HEIGHT:-1080} - VNC_PASSWORD=${VNC_PASSWORD:-vncpassword} - - PERSISTENT_BROWSER_PORT=9222 - - PERSISTENT_BROWSER_HOST=localhost - CHROME_DEBUGGING_PORT=9222 - CHROME_DEBUGGING_HOST=localhost volumes: - - ./data:/app/data - - ./data/chrome_data:/app/data/chrome_data - /tmp/.X11-unix:/tmp/.X11-unix restart: unless-stopped shm_size: '2gb' diff --git a/src/browser/custom_browser.py b/src/browser/custom_browser.py index 829e06e..5f4943c 100644 --- a/src/browser/custom_browser.py +++ b/src/browser/custom_browser.py @@ -5,6 +5,7 @@ # @FileName: browser.py import asyncio +import pdb from playwright.async_api import Browser as PlaywrightBrowser from playwright.async_api import ( diff --git a/src/utils/default_config_settings.py b/src/utils/default_config_settings.py index b4c08cf..02f9129 100644 --- a/src/utils/default_config_settings.py +++ b/src/utils/default_config_settings.py @@ -17,7 +17,7 @@ def default_config(): "llm_temperature": 1.0, "llm_base_url": "", "llm_api_key": "", - "use_own_browser": False, + "use_own_browser": os.getenv("CHROME_PERSISTENT_SESSION", False), "keep_browser_open": False, "headless": False, "disable_security": True, diff --git a/src/utils/utils.py b/src/utils/utils.py index 3ab3897..cfe24d3 100644 --- a/src/utils/utils.py +++ b/src/utils/utils.py @@ -88,7 +88,7 @@ def get_llm_model(provider: str, **kwargs): return ChatOllama( model=kwargs.get("model_name", "qwen2.5:7b"), temperature=kwargs.get("temperature", 0.0), - num_ctx=128000, + num_ctx=kwargs.get("num_ctx", 32000), base_url=kwargs.get("base_url", "http://localhost:11434"), ) elif provider == "azure_openai": diff --git a/supervisord.conf b/supervisord.conf index 9aac183..4408373 100644 --- a/supervisord.conf +++ b/supervisord.conf @@ -58,8 +58,8 @@ startsecs=3 depends_on=x11vnc [program:persistent_browser] -command=bash -c 'if [ "%(ENV_CHROME_PERSISTENT_SESSION)s" = "true" ]; then mkdir -p /app/data/chrome_data && sleep 8 && google-chrome --user-data-dir=/app/data/chrome_data --window-position=0,0 --window-size=%(ENV_RESOLUTION_WIDTH)s,%(ENV_RESOLUTION_HEIGHT)s --start-maximized --no-sandbox --disable-dev-shm-usage --disable-gpu --disable-software-rasterizer --disable-setuid-sandbox --no-first-run --no-default-browser-check --no-experiments --ignore-certificate-errors --remote-debugging-port=9222 --remote-debugging-address=0.0.0.0 "data:text/html,