[PR #22125] [CLOSED] fix: ensure RAG and specialized OpenAI configs inherit environment values #49552

Closed
opened 2026-04-30 01:51:00 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/22125
Author: @VedantMadane
Created: 3/2/2026
Status: Closed

Base: devHead: fix/config-openai-inheritance


📝 Commits (1)

  • cc527d7 fix: ensure RAG and other specialized OpenAI configs inherit INITIAL_OPENAI environment values

📊 Changes

1 file changed (+13 additions, -10 deletions)

View changed files

📝 backend/open_webui/config.py (+13 -10)

📄 Description

Fixes #22084.

Problem

Internal logic in config.py was resetting OPENAI_API_BASE_URL and OPENAI_API_KEY to hardcoded defaults mid-way through initialization. This caused specialized modules (RAG, Image Generation, Audio STT/TTS) to ignore user-provided environment variables and fallback to the hardcoded OpenAI defaults instead of the user's primary OpenAI configuration.

Solution

  • Introduced INITIAL_OPENAI_API_BASE_URL and INITIAL_OPENAI_API_KEY to capture environment values at the very start of initialization.
  • Updated all dependent PersistentConfig instances (RAG, IMAGES, AUDIO) to use these captured initial values as their defaults.
  • This ensures that if a user sets OPENAI_API_BASE_URL, it correctly flows down to RAG_OPENAI_API_BASE_URL if the latter is not explicitly set.

Testing Confirmation

I have personally tested these changes by setting the \OPENAI_API_BASE_URL\ and \OPENAI_API_KEY\ environment variables and verifying that the RAG, Image Generation, and Audio modules correctly inherit these values during initialization. I also verified that explicit overrides (e.g. setting \RAG_OPENAI_API_BASE_URL) still work as expected.

I agree to the contributor license agreement.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/22125 **Author:** [@VedantMadane](https://github.com/VedantMadane) **Created:** 3/2/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `fix/config-openai-inheritance` --- ### 📝 Commits (1) - [`cc527d7`](https://github.com/open-webui/open-webui/commit/cc527d7c0e98afb0f62da5f72401532271bd341c) fix: ensure RAG and other specialized OpenAI configs inherit INITIAL_OPENAI environment values ### 📊 Changes **1 file changed** (+13 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/config.py` (+13 -10) </details> ### 📄 Description Fixes #22084. ### Problem Internal logic in config.py was resetting OPENAI_API_BASE_URL and OPENAI_API_KEY to hardcoded defaults mid-way through initialization. This caused specialized modules (RAG, Image Generation, Audio STT/TTS) to ignore user-provided environment variables and fallback to the hardcoded OpenAI defaults instead of the user's primary OpenAI configuration. ### Solution - Introduced INITIAL_OPENAI_API_BASE_URL and INITIAL_OPENAI_API_KEY to capture environment values at the very start of initialization. - Updated all dependent PersistentConfig instances (RAG, IMAGES, AUDIO) to use these captured initial values as their defaults. - This ensures that if a user sets OPENAI_API_BASE_URL, it correctly flows down to RAG_OPENAI_API_BASE_URL if the latter is not explicitly set. ### Testing Confirmation I have personally tested these changes by setting the \OPENAI_API_BASE_URL\ and \OPENAI_API_KEY\ environment variables and verifying that the RAG, Image Generation, and Audio modules correctly inherit these values during initialization. I also verified that explicit overrides (e.g. setting \RAG_OPENAI_API_BASE_URL\) still work as expected. I agree to the contributor license agreement. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-30 01:51:00 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#49552