Skip to content

Commit 7c52382

Browse files
committed
refac
1 parent ebc9ccb commit 7c52382

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

backend/open_webui/utils/middleware.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2370,11 +2370,16 @@ async def process_chat_payload(request, form_data, user, metadata, model):
23702370
)
23712371
else:
23722372
# Native FC: tool docstring can't be dynamic, so inject
2373-
# filesystem context into messages for pyodide engine
2373+
# filesystem context into the system message for pyodide
2374+
# engine. Appending to the system prompt (instead of the
2375+
# user message) keeps it in the stable cached prefix so
2376+
# providers with prefix caching don't re-bill the full
2377+
# conversation on every turn.
23742378
if engine != 'jupyter':
2375-
form_data['messages'] = add_or_update_user_message(
2379+
form_data['messages'] = add_or_update_system_message(
23762380
CODE_INTERPRETER_PYODIDE_PROMPT,
23772381
form_data['messages'],
2382+
append=True,
23782383
)
23792384

23802385
tool_ids = form_data.pop('tool_ids', None)

0 commit comments

Comments
 (0)