open-webui/backend/open_webui
Classic298 2f92635409
fix: keep the model system prompt on Ollama tool-call follow-ups (#30375)
With native function calling on an Ollama model, every request sent after a tool result was missing the model's system prompt, so the final answer ignored the model's instructions. Only other system content, such as the attached knowledge tag, was left. OpenAI connections were not affected.

Tool-call follow-ups are rebuilt from the chat's message list and skip the router's system prompt step, because the first request is expected to have already added it to that list. The OpenAI path does add it there, but the Ollama path converts the messages into a copy first and adds the prompt only to the copy, so the follow-ups never see it.

The model system prompt is now applied to the messages before the Ollama conversion, and the Ollama router is told to skip it for that request so it is not added twice. Ollama now behaves the same as the OpenAI path. Direct calls to /ollama/api/chat still get the prompt from the router as before.

Checked baseline against patched: first request and follow-up for plain, custom and arena Ollama models, with and without a chat system prompt, with template variables and on the OpenAI path. The prompt is now present exactly once on every Ollama follow-up, and nothing else changed.

Fixes #30161
2026-09-22 16:47:20 -04:00
..
data refac: mv backend files to /open_webui dir 2024-09-04 16:54:48 +02:00
internal refac 2026-09-06 17:13:32 -04:00
migrations chore: format 2026-08-25 16:53:53 -04:00
models refac 2026-09-22 13:13:22 -04:00
retrieval fix: page Chroma get() so hybrid search works on collections over 32k chunks (#30368) 2026-09-22 14:48:45 -04:00
routers refac 2026-09-22 13:13:22 -04:00
socket perf: per-room channel delivery for the socket.io Redis manager (#28818) 2026-09-22 14:48:56 -04:00
static refac 2026-09-06 17:27:30 -04:00
storage refac 2026-09-06 17:13:32 -04:00
tools refac 2026-09-21 08:59:39 -04:00
utils fix: keep the model system prompt on Ollama tool-call follow-ups (#30375) 2026-09-22 16:47:20 -04:00
__init__.py perf: allow disabling websocket per-message-deflate (#28613) 2026-08-24 18:46:07 -04:00
alembic.ini fix: Alembic CLI commands from failing 2025-08-15 04:17:47 -04:00
config.py refac 2026-09-21 11:09:09 -04:00
constants.py refac 2026-08-29 16:14:32 -04:00
env.py perf: per-room channel delivery for the socket.io Redis manager (#28818) 2026-09-22 14:48:56 -04:00
events.py refac 2026-08-16 23:21:00 -07:00
functions.py fix: honor bypass_system_prompt on the pipe route (#28739) 2026-08-19 11:08:02 -07:00
main.py refac 2026-09-21 08:59:39 -04:00
tasks.py refac 2026-09-21 08:59:39 -04:00