[GH-ISSUE #16855] issue: The process_chat_payload method in middleware.py has an issue with duplicate system prompts #33604

Closed
opened 2026-04-25 07:30:31 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @webboyvc on GitHub (Aug 23, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/16855

Check Existing Issues

  • I have searched the existing issues and discussions.
  • I am using the latest version of Open WebUI.

Installation Method

Git Clone

Open WebUI Version

main branch

Ollama Version (if applicable)

No response

Operating System

linux

Browser (if applicable)

No response

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

I remotely invoked the /api/chat/completions interface, and the data in the body is as follows:
{
"model":"qwen3:30b",
"stream":false,
"think":false,
"messages":[
{"role":"system","content":"You are an assistant!!!"},
{"role":"user","content":"who are you"}
]
}
When I set a breakpoint under the function process_chat_payload, I view the value of the variable form_data is:
[{'role': 'system', 'content': 'You are an assistant!!!\nYou are an assistant!!!'}, {'role': 'user', 'content': 'who are you'}]
but the correct value should be:
[{'role': 'system', 'content': 'You are an assistant!!!'}, {'role': 'user', 'content': 'who are you'}]

Actual Behavior

[{'role': 'system', 'content': 'You are an assistant!!!\nYou are an assistant!!!'}, {'role': 'user', 'content': 'who are you'}]

Steps to Reproduce

Go to line 744 of the file middleware.py

Logs & Screenshots

[{'role': 'system', 'content': 'You are an assistant!!!\nYou are an assistant!!!'}, {'role': 'user', 'content': 'who are you'}]

Additional Information

No response

Originally created by @webboyvc on GitHub (Aug 23, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/16855 ### Check Existing Issues - [x] I have searched the existing issues and discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Git Clone ### Open WebUI Version main branch ### Ollama Version (if applicable) _No response_ ### Operating System linux ### Browser (if applicable) _No response_ ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### Expected Behavior I remotely invoked the /api/chat/completions interface, and the data in the body is as follows: { "model":"qwen3:30b", "stream":false, "think":false, "messages":[ {"role":"system","content":"You are an assistant!!!"}, {"role":"user","content":"who are you"} ] } When I set a breakpoint under the function process_chat_payload, I view the value of the variable form_data is: [{'role': 'system', 'content': 'You are an assistant!!!\nYou are an assistant!!!'}, {'role': 'user', 'content': 'who are you'}] but the correct value should be: [{'role': 'system', 'content': 'You are an assistant!!!'}, {'role': 'user', 'content': 'who are you'}] ### Actual Behavior [{'role': 'system', 'content': 'You are an assistant!!!\nYou are an assistant!!!'}, {'role': 'user', 'content': 'who are you'}] ### Steps to Reproduce Go to line 744 of the file middleware.py ### Logs & Screenshots [{'role': 'system', 'content': 'You are an assistant!!!\nYou are an assistant!!!'}, {'role': 'user', 'content': 'who are you'}] ### Additional Information _No response_
GiteaMirror added the bug label 2026-04-25 07:30:31 -05:00
Author
Owner

@tjbck commented on GitHub (Sep 7, 2025):

#17198

<!-- gh-comment-id:3263756218 --> @tjbck commented on GitHub (Sep 7, 2025): #17198
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#33604