mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[PR #22093] [CLOSED] fix(config): RAG_OPENAI env vars now correctly inherit OPENAI_API values #49524
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/22093
Author: @giulio-leone
Created: 3/1/2026
Status: ❌ Closed
Base:
main← Head:fix/rag-openai-env-inheritance📝 Commits (1)
347e127fix(config): RAG_OPENAI env vars now inherit from OPENAI_API env vars📊 Changes
1 file changed (+6 additions, -2 deletions)
View changed files
📝
backend/open_webui/config.py(+6 -2)📄 Description
Summary
Fixes #22084
RAG_OPENAI_API_BASE_URLandRAG_OPENAI_API_KEYare supposed to fall back toOPENAI_API_BASE_URLandOPENAI_API_KEYwhen not explicitly set. However, the fallback references Python variables that have already been reset to defaults earlier inconfig.py:OPENAI_API_BASE_URLis reset to"https://api.openai.com/v1"(line 1144)OPENAI_API_KEYis reset to""(line 1134)By the time the RAG config is defined (~line 3067), both variables contain default/empty values regardless of what the user set via environment variables.
Root Cause
config.pyreassignsOPENAI_API_KEYandOPENAI_API_BASE_URLto extract the "official" OpenAI endpoint from the multi-provider arrays. This means the original user-supplied values are lost from the Python variables, even though they're still available inos.environ.Fix
Read the original environment variables directly via
os.environ.get()instead of referencing the already-reset Python variables:Behavior
OPENAI_API_BASE_URLsethttps://api.openai.com/v1❌OPENAI_API_KEYset""❌RAG_OPENAI_*explicitly setTesting
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.