feat: persist settings to backend #406

Closed
opened 2025-11-11 14:20:27 -06:00 by GiteaMirror · 7 comments
Owner

Originally created by @tjbck on GitHub (Mar 3, 2024).

Originally assigned to: @tjbck on GitHub.

Related #981 #988 #900

Originally created by @tjbck on GitHub (Mar 3, 2024). Originally assigned to: @tjbck on GitHub. Related #981 #988 #900
Author
Owner

@changchiyou commented on GitHub (Mar 12, 2024):

I don't have a clear idea yet on how to persist settings to the backend, but may I ask if you would welcome me to create a workaround PR for #988 in the meantime?

Here's my idea: Even though there is no documentation mentioning it, I observed that users can set DEFAULT_USER_ROLE in the environment variables and have it read by :

7ae4669f35/backend/config.py (L290)

Then assigned to app.state.DEFAULT_USER_ROLE in:

7ae4669f35/backend/apps/web/main.py (L33)

Could I apply a similar logic to handle USER_PERMISSIONS as well? For example:

7ae4669f35/backend/config.py (L291)

+ import ast

- USER_PERMISSIONS = {"chat": {"deletion": True}}
+ USER_PERMISSIONS = ast.literal_eval(os.environ.get("USER_PERMISSIONS", '{"chat": {"deletion": True}}'))
@changchiyou commented on GitHub (Mar 12, 2024): I don't have a clear idea yet on how to persist settings to the backend, but may I ask if you would welcome me to create a workaround PR for #988 in the meantime? Here's my idea: Even though there is no documentation mentioning it, I observed that users can set `DEFAULT_USER_ROLE` in the environment variables and have it read by : https://github.com/open-webui/open-webui/blob/7ae4669f350ad30b44594c5e76759db445d9bf5d/backend/config.py#L290 Then assigned to `app.state.DEFAULT_USER_ROLE` in: https://github.com/open-webui/open-webui/blob/7ae4669f350ad30b44594c5e76759db445d9bf5d/backend/apps/web/main.py#L33 Could I apply a similar logic to handle `USER_PERMISSIONS` as well? For example: https://github.com/open-webui/open-webui/blob/7ae4669f350ad30b44594c5e76759db445d9bf5d/backend/config.py#L291 ```diff + import ast - USER_PERMISSIONS = {"chat": {"deletion": True}} + USER_PERMISSIONS = ast.literal_eval(os.environ.get("USER_PERMISSIONS", '{"chat": {"deletion": True}}')) ```
Author
Owner

@Fusseldieb commented on GitHub (Apr 17, 2024):

This also applies to the OpenAI API key. It gets lost every container restart, even with a volume present.

@Fusseldieb commented on GitHub (Apr 17, 2024): This also applies to the OpenAI API key. It gets lost every container restart, even with a volume present.
Author
Owner

@ChaoticByte commented on GitHub (Apr 21, 2024):

For me also the "Enable New Sign Ups" setting resets to "Enable" every time the container is restarted.
Especially this setting should persist, and honestly this looks more like a bug than a missing feature.

(I don't want bots to flood my server with pending accounts)

@ChaoticByte commented on GitHub (Apr 21, 2024): For me also the "Enable New Sign Ups" setting resets to "Enable" every time the container is restarted. Especially this setting should persist, and honestly this looks more like a bug than a missing feature. (I don't want bots to flood my server with pending accounts)
Author
Owner

@frost19k commented on GitHub (Apr 30, 2024):

Chiming in to point out that Embedding Model Engine (in Document Settings) set to OpenAI does not persist either. Also, OPENAI_API_BASE_URL & OPENAI_API_KEY do not seem to reflect there. However, Embedding Model can be updated by setting RAG_EMBEDDING_MODEL var.

Edit: Found the relevant env vars

RAG_EMBEDDING_ENGINE=openai
RAG_OPENAI_API_BASE_URL=''
RAG_OPENAI_API_KEY=''
RAG_EMBEDDING_MODEL=''
CHUNK_SIZE=1000
CHUNK_OVERLAP=20
@frost19k commented on GitHub (Apr 30, 2024): Chiming in to point out that `Embedding Model Engine` (in Document Settings) set to `OpenAI` does not persist either. Also, `OPENAI_API_BASE_URL` & `OPENAI_API_KEY` do not seem to reflect there. However, `Embedding Model` can be updated by setting `RAG_EMBEDDING_MODEL` var. Edit: Found the relevant env vars ``` RAG_EMBEDDING_ENGINE=openai RAG_OPENAI_API_BASE_URL='' RAG_OPENAI_API_KEY='' RAG_EMBEDDING_MODEL='' CHUNK_SIZE=1000 CHUNK_OVERLAP=20 ```
Author
Owner

@JTHesse commented on GitHub (May 13, 2024):

Please make Default User Role persistent as well 🙃

@JTHesse commented on GitHub (May 13, 2024): Please make `Default User Role` persistent as well 🙃
Author
Owner

@changchiyou commented on GitHub (May 13, 2024):

@JTHesse It's already possible to make Default User Role persistent:

According to

90503be2ed/backend/config.py (L411)

, create your own enviroment at

90503be2ed/docker-compose.yaml (L27-L29)

. For example:

 environment: 
   - 'OLLAMA_BASE_URL=http://ollama:11434' 
   - 'WEBUI_SECRET_KEY=' 
+  - 'DEFAULT_USER_ROLE=user'
@changchiyou commented on GitHub (May 13, 2024): @JTHesse It's already possible to make `Default User Role` persistent: According to https://github.com/open-webui/open-webui/blob/90503be2edef1a1f7ce2074286b6316d5cb8868a/backend/config.py#L411 , create your own enviroment at https://github.com/open-webui/open-webui/blob/90503be2edef1a1f7ce2074286b6316d5cb8868a/docker-compose.yaml#L27-L29 . For example: ```diff environment: - 'OLLAMA_BASE_URL=http://ollama:11434' - 'WEBUI_SECRET_KEY=' + - 'DEFAULT_USER_ROLE=user' ```
Author
Owner

@mmmmmmmgo commented on GitHub (May 19, 2024):

https://github.com/open-webui/open-webui/discussions/1876

ENABLE_SIGNUP

@mmmmmmmgo commented on GitHub (May 19, 2024): https://github.com/open-webui/open-webui/discussions/1876 ENABLE_SIGNUP
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#406