[PR #2156] [MERGED] feat: save UI config changes to config.json #7708

Closed
opened 2025-11-11 17:33:53 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/2156
Author: @cheahjs
Created: 5/10/2024
Status: Merged
Merged: 5/13/2024
Merged by: @tjbck

Base: devHead: feat/save-config


📝 Commits (6)

  • 058eb76 feat: save UI config changes to config.json
  • f712c90 feat: raise an exception if a WrappedConfig is used as a response
  • 298e684 feat: switch to config proxy, remove config_get/set
  • a0dceb0 fix: nested WrappedConfig breaks things
  • 5d64822 refac: rename WrappedConfig to PersistedConfig
  • 0c033b5 refac: rename

📊 Changes

11 files changed (+627 additions, -364 deletions)

View changed files

📝 backend/apps/audio/main.py (+20 -19)
📝 backend/apps/images/main.py (+89 -68)
📝 backend/apps/ollama/main.py (+29 -25)
📝 backend/apps/openai/main.py (+25 -18)
📝 backend/apps/rag/main.py (+126 -107)
📝 backend/apps/web/main.py (+13 -9)
📝 backend/apps/web/routers/auths.py (+16 -16)
📝 backend/apps/web/routers/configs.py (+4 -4)
📝 backend/apps/web/routers/users.py (+3 -3)
📝 backend/config.py (+278 -73)
📝 backend/main.py (+24 -22)

📄 Description

Pull Request Checklist

  • Target branch: Pull requests should target the dev branch.
  • Description: Briefly describe the changes 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: Have you updated relevant documentation Open WebUI Docs, or other documentation sources?
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • Testing: Have you written and run sufficient tests for the changes?
  • Code Review: Have you self-reviewed your code and addressed any coding standard issues?

Description

Saves any changes made via the UI to config.json, and values in config.json override any environment variables set.

This is achieved with:

  1. WrappedConfig
    • Contains the logic for determining if a value has changed, and if so, persist it at the specified JSON path
    • Also has __get__ and __set__ decorators so that the config can be used as if it was the raw values in combination with AppConfig
  2. AppConfig
    • Basic logic for a dict class, it's just here to wrap WrappedConfigs so that app.state.config.VAR triggers the __get__ and __set__ decorators on WrappedConfig

Addresses: #1022


Changelog Entry

Added

  • Persist UI Config Changes: UI configuration changes are now automatically saved to the config.json file. Values within this file will override any environment variables you have set.

🔄 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/2156 **Author:** [@cheahjs](https://github.com/cheahjs) **Created:** 5/10/2024 **Status:** ✅ Merged **Merged:** 5/13/2024 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `feat/save-config` --- ### 📝 Commits (6) - [`058eb76`](https://github.com/open-webui/open-webui/commit/058eb765687a542e4ce542d5fc8aea921ef85035) feat: save UI config changes to config.json - [`f712c90`](https://github.com/open-webui/open-webui/commit/f712c900193d90b249f80efc15b22494dd467a30) feat: raise an exception if a WrappedConfig is used as a response - [`298e684`](https://github.com/open-webui/open-webui/commit/298e6848b383bf5b3d4590ffa3a95f8dc8450f7b) feat: switch to config proxy, remove config_get/set - [`a0dceb0`](https://github.com/open-webui/open-webui/commit/a0dceb06a5a3c31b9be8617179fe9c1876abc8ca) fix: nested WrappedConfig breaks things - [`5d64822`](https://github.com/open-webui/open-webui/commit/5d64822c84030c2a2c0631ddfa68362cd55463fa) refac: rename WrappedConfig to PersistedConfig - [`0c033b5`](https://github.com/open-webui/open-webui/commit/0c033b5b7b394dd525c6183c8962c6e680277534) refac: rename ### 📊 Changes **11 files changed** (+627 additions, -364 deletions) <details> <summary>View changed files</summary> 📝 `backend/apps/audio/main.py` (+20 -19) 📝 `backend/apps/images/main.py` (+89 -68) 📝 `backend/apps/ollama/main.py` (+29 -25) 📝 `backend/apps/openai/main.py` (+25 -18) 📝 `backend/apps/rag/main.py` (+126 -107) 📝 `backend/apps/web/main.py` (+13 -9) 📝 `backend/apps/web/routers/auths.py` (+16 -16) 📝 `backend/apps/web/routers/configs.py` (+4 -4) 📝 `backend/apps/web/routers/users.py` (+3 -3) 📝 `backend/config.py` (+278 -73) 📝 `backend/main.py` (+24 -22) </details> ### 📄 Description ## Pull Request Checklist - [x] **Target branch:** Pull requests should target the `dev` branch. - [x] **Description:** Briefly describe the changes 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:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources? - [ ] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation? - [ ] **Testing:** Have you written and run sufficient tests for the changes? - [x] **Code Review:** Have you self-reviewed your code and addressed any coding standard issues? --- ## Description Saves any changes made via the UI to `config.json`, and values in `config.json` override any environment variables set. This is achieved with: 1. `WrappedConfig` - Contains the logic for determining if a value has changed, and if so, persist it at the specified JSON path - Also has `__get__` and `__set__` decorators so that the config can be used as if it was the raw values in combination with `AppConfig` 2. `AppConfig` - Basic logic for a dict class, it's just here to wrap `WrappedConfig`s so that `app.state.config.VAR` triggers the `__get__` and `__set__` decorators on `WrappedConfig` Addresses: #1022 --- ### Changelog Entry ### Added - **Persist UI Config Changes**: UI configuration changes are now automatically saved to the `config.json` file. Values within this file will override any environment variables you have set. --- <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 2025-11-11 17:33:53 -06: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#7708