diff --git a/docker/pysandbox/Dockerfile b/docker/pysandbox/Dockerfile index 6792187..38cb661 100644 --- a/docker/pysandbox/Dockerfile +++ b/docker/pysandbox/Dockerfile @@ -6,5 +6,9 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* RUN pip install --no-cache-dir numpy pandas matplotlib scipy openpyxl pillow tabulate \ opencv-python-headless sympy scikit-learn statsmodels +# 2차 레이어(이미지 재빌드 시 위 레이어 캐시 유지): 웹/문서/3D 작업용. requests는 네트워크 자동허용 코드가 흔히 쓴다. +RUN pip install --no-cache-dir requests beautifulsoup4 lxml pyyaml seaborn \ + trimesh numpy-stl shapely networkx python-docx python-pptx pdfplumber pymupdf \ + reportlab xlsxwriter tqdm qrcode ENV MPLBACKEND=Agg MPLCONFIGDIR=/tmp/mpl HOME=/tmp PYTHONDONTWRITEBYTECODE=1 WORKDIR /work diff --git a/src/gateway/chat/personality-context.ts b/src/gateway/chat/personality-context.ts index bb6cc99..c015e4e 100644 --- a/src/gateway/chat/personality-context.ts +++ b/src/gateway/chat/personality-context.ts @@ -202,7 +202,7 @@ RULES: 현재날씨/예보 → 한국은 weather_kma, 해외는 weather_openmete image_ocr: `IMAGE OCR TOOL: image_read(path, lang?) → extract text from an image file via OCR. Supported formats: PNG, JPG, WEBP, BMP, TIFF. lang: "eng" (English, default), "kor" (Korean), "kor+eng" (both). Returns extracted text and confidence score. Useful for screenshots, scanned documents, and diagrams containing text.`, - python: `PYTHON TOOL: python_eval(code, timeout?, packages?) → execute Python code in the workspace directory. Returns stdout/stderr. timeout default 15s, max 60s. packages: comma-separated pip packages to install if missing (e.g. "numpy,pandas"). Runs in an offline Docker sandbox (no internet unless network:true; host files outside the workspace are invisible; pip install is unavailable). Preinstalled: numpy pandas matplotlib scipy openpyxl pillow opencv sympy scikit-learn statsmodels. For Korean text in matplotlib: fm.fontManager.addfont('/usr/share/fonts/truetype/nanum/NanumGothic.ttf'); plt.rc('font', family='NanumGothic'). Use for math, data analysis, CSV/JSON processing, charting (save chart to workspace file). IMAGE EDITING: input path = exact string from [IMAGE PATH for image_edit/python_eval — use EXACTLY this string: ...] hint in the message. Save output to uploads/.jpg. FONT: For Korean/CJK text in Pillow (speech bubbles, watermarks, etc.) use ImageFont.truetype("/usr/share/fonts/truetype/nanum/NanumGothicBold.ttf", size) — DejaVuSans does NOT support Korean.`, + python: `PYTHON TOOL: python_eval(code, timeout?, packages?) → execute Python code in the workspace directory. Returns stdout/stderr. timeout default 15s, max 60s. packages: comma-separated pip packages to install if missing (e.g. "numpy,pandas"). Runs in an offline Docker sandbox (no internet unless network:true; host files outside the workspace are invisible; pip install is unavailable). Preinstalled: numpy pandas matplotlib seaborn scipy sympy scikit-learn statsmodels openpyxl xlsxwriter pillow opencv requests beautifulsoup4 lxml pyyaml trimesh numpy-stl shapely networkx python-docx python-pptx pdfplumber pymupdf reportlab qrcode tqdm. For Korean text in matplotlib: fm.fontManager.addfont('/usr/share/fonts/truetype/nanum/NanumGothic.ttf'); plt.rc('font', family='NanumGothic'). Use for math, data analysis, CSV/JSON processing, charting (save chart to workspace file). IMAGE EDITING: input path = exact string from [IMAGE PATH for image_edit/python_eval — use EXACTLY this string: ...] hint in the message. Save output to uploads/.jpg. FONT: For Korean/CJK text in Pillow (speech bubbles, watermarks, etc.) use ImageFont.truetype("/usr/share/fonts/truetype/nanum/NanumGothicBold.ttf", size) — DejaVuSans does NOT support Korean.`, sqlite: `SQLITE TOOL: sqlite_query(db_path, query, write?, max_rows?) → query a SQLite .db file in the workspace. SELECT queries allowed by default. Set write=true for INSERT/UPDATE/DELETE/CREATE/DROP. Returns formatted table. db_path is relative to workspace or absolute (must be inside workspace).`, }; diff --git a/src/tools/python.ts b/src/tools/python.ts index feec03c..28744aa 100644 --- a/src/tools/python.ts +++ b/src/tools/python.ts @@ -147,7 +147,7 @@ export const pythonEvalTool = { const containerName = `pyeval-${process.pid}-${Date.now()}`; let sandboxNote = ''; if (args?.packages && useSandbox) { - sandboxNote = 'packages 인자는 샌드박스에서 무시됨(설치 불가). 기본 포함: numpy pandas matplotlib scipy openpyxl pillow opencv sympy scikit-learn statsmodels. 그 외 패키지가 꼭 필요하면 사용자에게 알릴 것.'; + sandboxNote = 'packages 인자는 샌드박스에서 무시됨(설치 불가). 기본 포함: numpy pandas matplotlib seaborn scipy sympy scikit-learn statsmodels openpyxl xlsxwriter pillow opencv requests beautifulsoup4 lxml pyyaml trimesh numpy-stl shapely networkx python-docx python-pptx pdfplumber pymupdf reportlab qrcode tqdm. 그 외 패키지가 꼭 필요하면 사용자에게 알릴 것.'; } if (args?.packages && !useSandbox) { const pkgs = String(args.packages).split(',').map((p: string) => p.trim()).filter((p: string) => /^[a-zA-Z0-9_\-\.]+$/.test(p));