[PR #18764] [CLOSED] feat: add ability to set default for stream response chat option #24911

Closed
opened 2026-04-20 05:39:02 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/18764
Author: @zalbiraw
Created: 10/31/2025
Status: Closed

Base: devHead: main


📝 Commits (1)

  • baa9924 add ability to set default for stream reponse chat option

📊 Changes

6 files changed (+18 additions, -2 deletions)

View changed files

📝 .env.example (+6 -0)
📝 backend/open_webui/config.py (+6 -0)
📝 backend/open_webui/main.py (+3 -0)
📝 src/lib/components/chat/Chat.svelte (+1 -0)
📝 src/lib/components/notes/NoteEditor.svelte (+1 -1)
📝 src/lib/components/notes/NoteEditor/Chat.svelte (+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.

Add ability to set a global variable for stream response configuration.

Before submitting, make sure you've checked the following:

  • Target branch: Verify that the pull request targets the dev branch. Not targeting the dev branch may lead to immediate closure of the PR.
  • Description: Provide a concise description of the changes made in this pull request.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Documentation: If necessary, update relevant documentation Open WebUI Docs like environment variables, the tutorials, or other documentation sources.
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • Testing: Perform manual tests to verify the implemented fix/feature works as intended AND does not break any other functionality. Take this as an opportunity to make screenshots of the feature/fix and include it in the PR description.
  • Agentic AI Code:: Confirm this Pull Request is not written by any AI Agent or has at least gone through additional human review and manual testing. If any AI Agent is the co-author of this PR, it may lead to immediate closure of the PR.
  • Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
  • Title Prefix: To clearly categorize this pull request, prefix the pull request title using one of the following:
    • BREAKING CHANGE: Significant changes that may affect compatibility
    • build: Changes that affect the build system or external dependencies
    • ci: Changes to our continuous integration processes or workflows
    • chore: Refactor, cleanup, or other non-functional code changes
    • docs: Documentation update or addition
    • feat: Introduces a new feature or enhancement to the codebase ✓ (Selected for this PR)
    • fix: Bug fix or error correction
    • i18n: Internationalization or localization changes
    • perf: Performance improvement
    • refactor: Code restructuring for better maintainability, readability, or scalability
    • style: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.)
    • test: Adding missing tests or correcting existing tests
    • WIP: Work in progress, a temporary label for incomplete or ongoing work

Changelog Entry

Description

  • This pull request adds a global environment variable DEFAULT_CHAT_STREAM_RESPONSE that allows administrators to control the default streaming behavior for chat responses across the entire Open WebUI deployment. This feature provides deployment-level control while still allowing individual users to override the setting in their personal preferences.

Motivation: Organizations may want to disable streaming by default for various reasons including performance optimization, compliance requirements, or user preference policies. This change enables administrators to set a system-wide default without requiring each user to manually configure their settings.

Impact: This is a backward-compatible addition. The default value is True, maintaining existing streaming behavior. Users can still override this setting in their individual chat settings (Settings > General > Advanced Parameters > Stream Chat Response).

Added

  • Environment Variable: DEFAULT_CHAT_STREAM_RESPONSE - Controls the default streaming behavior for chat responses
    • Values: True (enable streaming, default) or False (disable streaming)
    • Configurable via environment variables, Docker Compose, Kubernetes, etc.
  • Backend Configuration:
    • Added DEFAULT_CHAT_STREAM_RESPONSE as a PersistentConfig in backend/open_webui/config.py
    • Exposed configuration in backend/open_webui/main.py app state
    • Added to config API endpoint for frontend access (/api/config)
  • Frontend Integration:
    • Updated src/lib/components/chat/Chat.svelte to check global config before hardcoded default
    • Updated src/lib/components/notes/NoteEditor.svelte to respect global streaming config
    • Updated src/lib/components/notes/NoteEditor/Chat.svelte to respect global streaming config
  • Documentation:
    • Added configuration example to .env.example
    • Created STREAMING_CONFIG.md with comprehensive usage guide

Changed

  • Stream Priority Chain: Updated the streaming determination logic to include global config:
    1. Model-specific setting (highest priority)
    2. User preference setting
    3. Request-specific parameter
    4. Global default (DEFAULT_CHAT_STREAM_RESPONSE) ← NEW
    5. Hardcoded fallback (true)

Deprecated

  • None

Removed

  • None

Fixed

  • None

Security

  • None

Breaking Changes

  • BREAKING CHANGE: None - This is a backward-compatible addition. The default behavior remains unchanged (streaming enabled).

Additional Information

  • Configuration Priority:
    The streaming behavior is determined by the following priority chain (highest to lowest):

    1. Model-specific setting - Configured per model in model settings
    2. User preference - Set in user's chat settings
    3. Request-specific parameter - Per-request override via API
    4. Global default - Set via DEFAULT_CHAT_STREAM_RESPONSE environment variable
    5. Hardcoded fallback - true
  • Use Cases:

    • Resource-constrained environments: Disable streaming to reduce server load
    • Compliance requirements: Some organizations require complete responses before display
    • User experience consistency: Set organization-wide defaults
    • Performance optimization: Disable streaming for faster perceived response times in certain scenarios
  • Testing Performed:

    • Verified DEFAULT_CHAT_STREAM_RESPONSE=True maintains existing streaming behavior
    • Verified DEFAULT_CHAT_STREAM_RESPONSE=False disables streaming by default
    • Verified user settings still override global configuration
    • Tested in main chat interface
    • Tested in notes editor
    • Tested config API endpoint exposes the setting correctly
  • Related Files:

    • backend/open_webui/config.py - Config definition
    • backend/open_webui/main.py - App state integration
    • src/lib/components/chat/Chat.svelte - Main chat component
    • src/lib/components/notes/NoteEditor.svelte - Notes editor
    • src/lib/components/notes/NoteEditor/Chat.svelte - Notes chat
    • .env.example - Documentation
    • STREAMING_CONFIG.md - Comprehensive guide
  • Example Usage:

    Docker Compose:

    services:
      open-webui:
        environment:
          - DEFAULT_CHAT_STREAM_RESPONSE=False
    

    Docker Run:

    docker run -e DEFAULT_CHAT_STREAM_RESPONSE=False open-webui
    

    Kubernetes:

    env:
      - name: DEFAULT_CHAT_STREAM_RESPONSE
        value: "False"
    

Screenshots or Videos

  • The feature works at the configuration level and doesn't change the UI. The streaming behavior changes based on the environment variable:

    With DEFAULT_CHAT_STREAM_RESPONSE=True (default):

    • Responses stream word-by-word in real-time

    With DEFAULT_CHAT_STREAM_RESPONSE=False:

    • Responses appear all at once after completion

    Users can still override this in Settings > General > Advanced Parameters > Stream Chat Response (On/Off/Default).

Contributor License Agreement

By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.


🔄 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/18764 **Author:** [@zalbiraw](https://github.com/zalbiraw) **Created:** 10/31/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `main` --- ### 📝 Commits (1) - [`baa9924`](https://github.com/open-webui/open-webui/commit/baa99240d57dde2a99e45d19da19f37a4c54f4d7) add ability to set default for stream reponse chat option ### 📊 Changes **6 files changed** (+18 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `.env.example` (+6 -0) 📝 `backend/open_webui/config.py` (+6 -0) 📝 `backend/open_webui/main.py` (+3 -0) 📝 `src/lib/components/chat/Chat.svelte` (+1 -0) 📝 `src/lib/components/notes/NoteEditor.svelte` (+1 -1) 📝 `src/lib/components/notes/NoteEditor/Chat.svelte` (+1 -1) </details> ### 📄 Description # Pull Request Checklist ### Note to first-time contributors: Please open a discussion post in [Discussions](https://github.com/open-webui/open-webui/discussions) and describe your changes before submitting a pull request. Add ability to set a global variable for stream response configuration. **Before submitting, make sure you've checked the following:** - [x] **Target branch:** Verify that the pull request targets the `dev` branch. Not targeting the `dev` branch may lead to immediate closure of the PR. - [x] **Description:** Provide a concise description of the changes made in this pull request. - [x] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description. - [ ] **Documentation:** If necessary, update relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs) like environment variables, the tutorials, or other documentation sources. - [ ] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation? - [x] **Testing:** Perform manual tests to verify the implemented fix/feature works as intended AND does not break any other functionality. Take this as an opportunity to make screenshots of the feature/fix and include it in the PR description. - [x] **Agentic AI Code:**: Confirm this Pull Request is **not written by any AI Agent** or has at least gone through additional human review **and** manual testing. If any AI Agent is the co-author of this PR, it may lead to immediate closure of the PR. - [x] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards? - [x] **Title Prefix:** To clearly categorize this pull request, prefix the pull request title using one of the following: - **BREAKING CHANGE**: Significant changes that may affect compatibility - **build**: Changes that affect the build system or external dependencies - **ci**: Changes to our continuous integration processes or workflows - **chore**: Refactor, cleanup, or other non-functional code changes - **docs**: Documentation update or addition - **feat**: Introduces a new feature or enhancement to the codebase ✓ (Selected for this PR) - **fix**: Bug fix or error correction - **i18n**: Internationalization or localization changes - **perf**: Performance improvement - **refactor**: Code restructuring for better maintainability, readability, or scalability - **style**: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.) - **test**: Adding missing tests or correcting existing tests - **WIP**: Work in progress, a temporary label for incomplete or ongoing work # Changelog Entry ### Description - This pull request adds a global environment variable `DEFAULT_CHAT_STREAM_RESPONSE` that allows administrators to control the default streaming behavior for chat responses across the entire Open WebUI deployment. This feature provides deployment-level control while still allowing individual users to override the setting in their personal preferences. **Motivation:** Organizations may want to disable streaming by default for various reasons including performance optimization, compliance requirements, or user preference policies. This change enables administrators to set a system-wide default without requiring each user to manually configure their settings. **Impact:** This is a backward-compatible addition. The default value is `True`, maintaining existing streaming behavior. Users can still override this setting in their individual chat settings (Settings > General > Advanced Parameters > Stream Chat Response). ### Added - **Environment Variable**: `DEFAULT_CHAT_STREAM_RESPONSE` - Controls the default streaming behavior for chat responses - Values: `True` (enable streaming, default) or `False` (disable streaming) - Configurable via environment variables, Docker Compose, Kubernetes, etc. - **Backend Configuration**: - Added `DEFAULT_CHAT_STREAM_RESPONSE` as a `PersistentConfig` in `backend/open_webui/config.py` - Exposed configuration in `backend/open_webui/main.py` app state - Added to config API endpoint for frontend access (`/api/config`) - **Frontend Integration**: - Updated `src/lib/components/chat/Chat.svelte` to check global config before hardcoded default - Updated `src/lib/components/notes/NoteEditor.svelte` to respect global streaming config - Updated `src/lib/components/notes/NoteEditor/Chat.svelte` to respect global streaming config - **Documentation**: - Added configuration example to `.env.example` - Created `STREAMING_CONFIG.md` with comprehensive usage guide ### Changed - **Stream Priority Chain**: Updated the streaming determination logic to include global config: 1. Model-specific setting (highest priority) 2. User preference setting 3. Request-specific parameter 4. **Global default (`DEFAULT_CHAT_STREAM_RESPONSE`)** ← NEW 5. Hardcoded fallback (`true`) ### Deprecated - None ### Removed - None ### Fixed - None ### Security - None ### Breaking Changes - **BREAKING CHANGE**: None - This is a backward-compatible addition. The default behavior remains unchanged (streaming enabled). --- ### Additional Information - **Configuration Priority:** The streaming behavior is determined by the following priority chain (highest to lowest): 1. Model-specific setting - Configured per model in model settings 2. User preference - Set in user's chat settings 3. Request-specific parameter - Per-request override via API 4. Global default - Set via `DEFAULT_CHAT_STREAM_RESPONSE` environment variable 5. Hardcoded fallback - `true` - **Use Cases:** - **Resource-constrained environments**: Disable streaming to reduce server load - **Compliance requirements**: Some organizations require complete responses before display - **User experience consistency**: Set organization-wide defaults - **Performance optimization**: Disable streaming for faster perceived response times in certain scenarios - **Testing Performed:** - ✅ Verified `DEFAULT_CHAT_STREAM_RESPONSE=True` maintains existing streaming behavior - ✅ Verified `DEFAULT_CHAT_STREAM_RESPONSE=False` disables streaming by default - ✅ Verified user settings still override global configuration - ✅ Tested in main chat interface - ✅ Tested in notes editor - ✅ Tested config API endpoint exposes the setting correctly - **Related Files:** - `backend/open_webui/config.py` - Config definition - `backend/open_webui/main.py` - App state integration - `src/lib/components/chat/Chat.svelte` - Main chat component - `src/lib/components/notes/NoteEditor.svelte` - Notes editor - `src/lib/components/notes/NoteEditor/Chat.svelte` - Notes chat - `.env.example` - Documentation - `STREAMING_CONFIG.md` - Comprehensive guide - **Example Usage:** Docker Compose: ```yaml services: open-webui: environment: - DEFAULT_CHAT_STREAM_RESPONSE=False ``` Docker Run: ```bash docker run -e DEFAULT_CHAT_STREAM_RESPONSE=False open-webui ``` Kubernetes: ```yaml env: - name: DEFAULT_CHAT_STREAM_RESPONSE value: "False" ``` ### Screenshots or Videos - The feature works at the configuration level and doesn't change the UI. The streaming behavior changes based on the environment variable: **With `DEFAULT_CHAT_STREAM_RESPONSE=True` (default):** - Responses stream word-by-word in real-time **With `DEFAULT_CHAT_STREAM_RESPONSE=False`:** - Responses appear all at once after completion Users can still override this in Settings > General > Advanced Parameters > Stream Chat Response (On/Off/Default). ### Contributor License Agreement By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. --- <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-20 05:39:02 -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#24911