Skip to content

Commit 6e55321

Browse files
authored
Merge pull request #141 from vvincent1234/fix/docker_vnc
Fix/docker vnc
2 parents a123e94 + d26ebe8 commit 6e55321

8 files changed

+16
-16
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
data
2+
tmp

Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ RUN pip install --no-cache-dir -r requirements.txt
6161
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
6262
RUN playwright install --with-deps chromium
6363
RUN playwright install-deps
64+
RUN apt-get install -y google-chrome-stable
6465

6566
# Copy the application code
6667
COPY . .

docker-compose.yml

-4
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,9 @@ services:
2828
- RESOLUTION_WIDTH=${RESOLUTION_WIDTH:-1920}
2929
- RESOLUTION_HEIGHT=${RESOLUTION_HEIGHT:-1080}
3030
- VNC_PASSWORD=${VNC_PASSWORD:-vncpassword}
31-
- PERSISTENT_BROWSER_PORT=9222
32-
- PERSISTENT_BROWSER_HOST=localhost
3331
- CHROME_DEBUGGING_PORT=9222
3432
- CHROME_DEBUGGING_HOST=localhost
3533
volumes:
36-
- ./data:/app/data
37-
- ./data/chrome_data:/app/data/chrome_data
3834
- /tmp/.X11-unix:/tmp/.X11-unix
3935
restart: unless-stopped
4036
shm_size: '2gb'

src/browser/custom_browser.py

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# @FileName: browser.py
66

77
import asyncio
8+
import pdb
89

910
from playwright.async_api import Browser as PlaywrightBrowser
1011
from playwright.async_api import (

src/utils/default_config_settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def default_config():
1717
"llm_temperature": 1.0,
1818
"llm_base_url": "",
1919
"llm_api_key": "",
20-
"use_own_browser": False,
20+
"use_own_browser": os.getenv("CHROME_PERSISTENT_SESSION", False),
2121
"keep_browser_open": False,
2222
"headless": False,
2323
"disable_security": True,

src/utils/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def get_llm_model(provider: str, **kwargs):
8888
return ChatOllama(
8989
model=kwargs.get("model_name", "qwen2.5:7b"),
9090
temperature=kwargs.get("temperature", 0.0),
91-
num_ctx=128000,
91+
num_ctx=kwargs.get("num_ctx", 32000),
9292
base_url=kwargs.get("base_url", "http://localhost:11434"),
9393
)
9494
elif provider == "azure_openai":

supervisord.conf

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ startsecs=3
5858
depends_on=x11vnc
5959

6060
[program:persistent_browser]
61-
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,<html><body style=\"background: \#f0f0f0; margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; font-family: Arial;\"><h1>Browser Ready for AI Interaction</h1></body></html>"; else echo "Persistent browser disabled"; fi'
62-
autorestart=%(ENV_CHROME_PERSISTENT_SESSION)s
61+
command=bash -c '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,<html><body style=\"background: \#f0f0f0; margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; font-family: Arial;\"><h1>Browser Ready for AI Interaction</h1></body></html>"'
62+
autorestart=true
6363
stdout_logfile=/dev/stdout
6464
stdout_logfile_maxbytes=0
6565
stderr_logfile=/dev/stderr

tests/test_browser_use.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -247,18 +247,18 @@ async def test_browser_use_custom_v2():
247247
# api_key=os.getenv("GOOGLE_API_KEY", "")
248248
# )
249249

250-
llm = utils.get_llm_model(
251-
provider="deepseek",
252-
model_name="deepseek-chat",
253-
temperature=0.8
254-
)
255-
256250
# llm = utils.get_llm_model(
257-
# provider="ollama", model_name="qwen2.5:7b", temperature=0.8
251+
# provider="deepseek",
252+
# model_name="deepseek-chat",
253+
# temperature=0.8
258254
# )
259255

256+
llm = utils.get_llm_model(
257+
provider="ollama", model_name="qwen2.5:7b", temperature=0.5
258+
)
259+
260260
controller = CustomController()
261-
use_own_browser = True
261+
use_own_browser = False
262262
disable_security = True
263263
use_vision = False # Set to False when using DeepSeek
264264
tool_call_in_content = True # Set to True when using Ollama

0 commit comments

Comments
 (0)