mirror of
https://github.com/open-webui/open-webui.git
synced 2026-03-22 14:13:08 -05:00
[PR #8740] [CLOSED] fix: Treat empty string as None when checking config_value #9076
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/8740
Author: @hurxxxx
Created: 1/22/2025
Status: ❌ Closed
Base:
dev← Head:dev📝 Commits (1)
d29b314fix: Treat empty string as None when checking config_value📊 Changes
1 file changed (+1 additions, -1 deletions)
View changed files
📝
backend/open_webui/config.py(+1 -1)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.
Before submitting, make sure you've checked the following:
devbranch.Changelog Entry
Description
Updated conditional logic to treat None and an empty string ("") as equivalent when evaluating self.config_value.
This update addresses the following issues:
An environment variable of type string defined in .env is not applied correctly. For example, when defining a prompt for QUERY_GENERATION_PROMPT_TEMPLATE, it is not properly reflected in the application.
The function get_config_value(task.query.prompt_template) returns an empty string ("") and stores it as an empty string in the config table in the database.
The code
if self.config_value is not None:does not account for empty strings, preventing the use of values from os.env.This fix ensures that both None and empty strings are treated consistently, allowing the appropriate fallback to environment variables.
If there was another intent behind not evaluating "", I will withdraw the PR.
Added
Changed
Deprecated
Removed
Fixed
Security
Breaking Changes
Additional Information
Screenshots or Videos
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.