mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-07 02:58:21 +00:00
refac
This commit is contained in:
parent
8913f37c3d
commit
989938856f
2 changed files with 9 additions and 4 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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"],
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue