This commit is contained in:
Timothy Jaeryang Baek
2026-03-07 20:05:18 -06:00
parent 8913f37c3d
commit 989938856f
2 changed files with 9 additions and 4 deletions

View File

@@ -2313,7 +2313,12 @@ You have access to a Python code interpreter via: `<code_interpreter type="code"
Ensure the code interpreter is effectively utilized to achieve the highest-quality analysis for the user."""
# Appended to the code interpreter prompt only when engine is pyodide (not jupyter)
CODE_INTERPRETER_PYODIDE_FS_PROMPT = """
CODE_INTERPRETER_PYODIDE_PROMPT = """
##### Pyodide Environment
- This Python environment runs via Pyodide in the browser. **Do not install packages** — `pip install`, `subprocess`, and `micropip.install()` are not available.
- If a required library is unavailable, use an alternative approach with available modules. Do not attempt to install anything.
##### Persistent File System

View File

@@ -120,7 +120,7 @@ from open_webui.config import (
DEFAULT_VOICE_MODE_PROMPT_TEMPLATE,
DEFAULT_TOOLS_FUNCTION_CALLING_PROMPT_TEMPLATE,
DEFAULT_CODE_INTERPRETER_PROMPT,
CODE_INTERPRETER_PYODIDE_FS_PROMPT,
CODE_INTERPRETER_PYODIDE_PROMPT,
CODE_INTERPRETER_BLOCKED_MODULES,
)
from open_webui.env import (
@@ -2378,7 +2378,7 @@ async def process_chat_payload(request, form_data, user, metadata, model):
# Append filesystem awareness only for pyodide engine
if engine != "jupyter":
prompt += CODE_INTERPRETER_PYODIDE_FS_PROMPT
prompt += CODE_INTERPRETER_PYODIDE_PROMPT
form_data["messages"] = add_or_update_user_message(
prompt,
@@ -2389,7 +2389,7 @@ async def process_chat_payload(request, form_data, user, metadata, model):
# filesystem context into messages for pyodide engine
if engine != "jupyter":
form_data["messages"] = add_or_update_user_message(
CODE_INTERPRETER_PYODIDE_FS_PROMPT,
CODE_INTERPRETER_PYODIDE_PROMPT,
form_data["messages"],
)