Installed via official docker repo ghcr.io/open-webui/open-webui:main
Environment
Open WebUI Version: 0.4.4
Operating System: Ubuntu 2204 (Server), Windows 10 (Client)
Browser (if applicable): Chrome 131
Confirmation:
I have read and followed all the instructions provided in the README.md.
I am on 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 the exact steps to reproduce the bug in the "Steps to Reproduce" section below.
Expected Behavior:
When setting a valve via user valves or system valves, the value of that particular item is set in the class "Valves" oder "UserValves".
E.g. if I set Source Language to "English" I expect that self.UserValves.sourceLanguage returns "English"
Actual Behavior:
self.UserValves.sourceLanguage and self.Vavlves.sourceLanguage always return the default value, no matter what is set in the user valves or the system valves (valves in "Functions" of admin panel).
Reproduction Details
Steps to Reproduce:
Create a new filter/function
You may use the default template for the conversation turns or the attached modified one, that outputs the Valve values.
Set the UserValues for the filter function "Conversation turns" to 1 (you may also try to set the valves in "Functions" menu as Admin, same result)
Observe how you can still do as many turns as defined in the defaults
Logs and Screenshots
Screenshots/Screen Recordings (if applicable):
Additional Information
The UI says that valves are saved, whenever I change them, but this is not reflected in the filter output
Modified conversation turns code for quicker testing:
"""
title: Example Filter
author: open-webui
author_url: https://github.com/open-webui
funding_url: https://github.com/open-webui
version: 0.1
"""frompydanticimportBaseModel,FieldfromtypingimportOptionalclassFilter:classValves(BaseModel):priority:int=Field(default=0,description="Priority level for the filter operations.")max_turns:int=Field(default=8,description="Maximum allowable conversation turns for a user.")passclassUserValves(BaseModel):max_turns:int=Field(default=4,description="Maximum allowable conversation turns for a user.")passdef__init__(self):# Indicates custom file handling logic. This flag helps disengage default routines in favor of custom# implementations, informing the WebUI to defer file-related operations to designated methods within this class.# Alternatively, you can remove the files directly from the body in from the inlet hook# self.file_handler = True# Initialize 'valves' with specific configurations. Using 'Valves' instance helps encapsulate settings,# which ensures settings are managed cohesively and not confused with operational flags like 'file_handler'.self.valves=self.Valves()self.user_valves=self.UserValves()passdefinlet(self,body:dict,__user__:Optional[dict]=None)->dict:# Modify the request body or validate it before processing by the chat completion API.# This function is the pre-processor for the API where various checks on the input can be performed.# It can also modify the request before sending it to the API.print(f"inlet:{__name__}")print(f"inlet:body:{body}")print(f"inlet:user:{__user__}")if__user__.get("role","admin")in["user","admin"]:messages=body.get("messages",[])max_turns=min(__user__["valves"].max_turns,self.valves.max_turns)iflen(messages)>max_turns:raiseException(f"Conversation turn limit exceeded. Max turns: {max_turns}")returnbodydefoutlet(self,body:dict,__user__:Optional[dict]=None)->dict:# Modify or analyze the response body after processing by the API.# This function is the post-processor for the API, which can be used to modify the response# or perform additional checks and analytics.print(f"outlet:{__name__}")print(f"outlet:body:{body}")print(f"outlet:user:{__user__}")messages=body.get("messages",[])messages[-1]["content"]=(messages[-1]["content"]+"\n"+" self.Valves: "+str(self.valves)+" / "+"self.UserValves: "+str(self.user_valves))returnbody```
Originally created by @clang88 on GitHub (Nov 25, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/7331
# Bug Report
## Installation Method
Installed via official docker repo ghcr.io/open-webui/open-webui:main
## Environment
- **Open WebUI Version:** 0.4.4
- **Operating System:** Ubuntu 2204 (Server), Windows 10 (Client)
- **Browser (if applicable):** Chrome 131
**Confirmation:**
- [x] I have read and followed all the instructions provided in the README.md.
- [x] I am on the latest version of both Open WebUI and Ollama.
- [] I have included the browser console logs.
- [] I have included the Docker container logs.
- [x] I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below.
## Expected Behavior:
When setting a valve via user valves or system valves, the value of that particular item is set in the class "Valves" oder "UserValves".
E.g. if I set Source Language to "English" I expect that `self.UserValves.sourceLanguage` returns "English"
## Actual Behavior:
`self.UserValves.sourceLanguage` and `self.Vavlves.sourceLanguage` always return the default value, no matter what is set in the user valves or the system valves (valves in "Functions" of admin panel).
## Reproduction Details
**Steps to Reproduce:**
1. Create a new filter/function
* You may use the default template for the conversation turns or the attached modified one, that outputs the Valve values.
3. Set the UserValues for the filter function "Conversation turns" to 1 (you may also try to set the valves in "Functions" menu as Admin, same result)
4. Observe how you can still do as many turns as defined in the defaults
## Logs and Screenshots
**Screenshots/Screen Recordings (if applicable):**

## Additional Information
The UI says that valves are saved, whenever I change them, but this is not reflected in the filter output
Modified conversation turns code for quicker testing:
```python
"""
title: Example Filter
author: open-webui
author_url: https://github.com/open-webui
funding_url: https://github.com/open-webui
version: 0.1
"""
from pydantic import BaseModel, Field
from typing import Optional
class Filter:
class Valves(BaseModel):
priority: int = Field(
default=0, description="Priority level for the filter operations."
)
max_turns: int = Field(
default=8, description="Maximum allowable conversation turns for a user."
)
pass
class UserValves(BaseModel):
max_turns: int = Field(
default=4, description="Maximum allowable conversation turns for a user."
)
pass
def __init__(self):
# Indicates custom file handling logic. This flag helps disengage default routines in favor of custom
# implementations, informing the WebUI to defer file-related operations to designated methods within this class.
# Alternatively, you can remove the files directly from the body in from the inlet hook
# self.file_handler = True
# Initialize 'valves' with specific configurations. Using 'Valves' instance helps encapsulate settings,
# which ensures settings are managed cohesively and not confused with operational flags like 'file_handler'.
self.valves = self.Valves()
self.user_valves = self.UserValves()
pass
def inlet(self, body: dict, __user__: Optional[dict] = None) -> dict:
# Modify the request body or validate it before processing by the chat completion API.
# This function is the pre-processor for the API where various checks on the input can be performed.
# It can also modify the request before sending it to the API.
print(f"inlet:{__name__}")
print(f"inlet:body:{body}")
print(f"inlet:user:{__user__}")
if __user__.get("role", "admin") in ["user", "admin"]:
messages = body.get("messages", [])
max_turns = min(__user__["valves"].max_turns, self.valves.max_turns)
if len(messages) > max_turns:
raise Exception(
f"Conversation turn limit exceeded. Max turns: {max_turns}"
)
return body
def outlet(self, body: dict, __user__: Optional[dict] = None) -> dict:
# Modify or analyze the response body after processing by the API.
# This function is the post-processor for the API, which can be used to modify the response
# or perform additional checks and analytics.
print(f"outlet:{__name__}")
print(f"outlet:body:{body}")
print(f"outlet:user:{__user__}")
messages = body.get("messages", [])
messages[-1]["content"] = (
messages[-1]["content"]
+ "\n"
+ " self.Valves: "
+ str(self.valves)
+ " / "
+ "self.UserValves: "
+ str(self.user_valves)
)
return body```
P.S.: It seems to work fine for "Tools".
Snapshot from system valves:
Snapshot from returned "Tools" call
Correction: It only works for the system valves, not for the user valves:
<!-- gh-comment-id:2497866119 -->
@clang88 commented on GitHub (Nov 25, 2024):
P.S.: It seems to work fine for "Tools".
Snapshot from system valves:

Snapshot from returned "Tools" call

Correction: It only works for the system valves, not for the user valves:

Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @clang88 on GitHub (Nov 25, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/7331
Bug Report
Installation Method
Installed via official docker repo ghcr.io/open-webui/open-webui:main
Environment
Open WebUI Version: 0.4.4
Operating System: Ubuntu 2204 (Server), Windows 10 (Client)
Browser (if applicable): Chrome 131
Confirmation:
Expected Behavior:
When setting a valve via user valves or system valves, the value of that particular item is set in the class "Valves" oder "UserValves".
E.g. if I set Source Language to "English" I expect that
self.UserValves.sourceLanguagereturns "English"Actual Behavior:
self.UserValves.sourceLanguageandself.Vavlves.sourceLanguagealways return the default value, no matter what is set in the user valves or the system valves (valves in "Functions" of admin panel).Reproduction Details
Steps to Reproduce:
Logs and Screenshots
Screenshots/Screen Recordings (if applicable):

Additional Information
The UI says that valves are saved, whenever I change them, but this is not reflected in the filter output
Modified conversation turns code for quicker testing:
@clang88 commented on GitHub (Nov 25, 2024):
P.S.: It seems to work fine for "Tools".


Snapshot from system valves:
Snapshot from returned "Tools" call
Correction: It only works for the system valves, not for the user valves:
