mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-17 08:21:12 -05:00
[PR #22584] [CLOSED] fix: skip Ollama-only Advanced Parameters when forwarding to non-Ollama endpoints #49816
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/22584
Author: @NIK-TIGER-BILL
Created: 3/11/2026
Status: ❌ Closed
Base:
main← Head:fix/ollama-params-leak-to-openai📝 Commits (1)
a59e5b9fix: skip Ollama-only params when forwarding to OpenAI-compatible endpoints📊 Changes
1 file changed (+21 additions, -1 deletions)
View changed files
📝
backend/open_webui/utils/middleware.py(+21 -1)📄 Description
Problem
Advanced Parameters like
num_ctx,mirostat,mirostat_eta,num_batch,num_gpu, etc. are Ollama-specific. When a user sets them for an Ollama model, they are stored inparams. Later, if any non-Ollama model is used in the same session (or the user has mixed models), these params land directly in the request body of the OpenAI-compatible endpoint, causing errors (fixes #22557):Root cause
In
utils/middleware.py, theelse-branch for non-Ollama models does:All params — including Ollama-only ones — are forwarded.
Fix
Define
OLLAMA_ONLY_PARAMS(the set of keys only meaningful to Ollama's/api/chatoptionsfield) and skip them in the non-Ollama path:Ollama models are unaffected — they still receive all params via
form_data['options'].Fixes #22557
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.