mirror of
https://github.com/open-webui/open-webui
synced 2024-11-28 15:05:07 +00:00
Merge pull request #3591 from michaelpoluektov/fix-banners-env
fix: fix WEBUI_BANNERS environment variable not working
This commit is contained in:
commit
2c061777ca
@ -5,9 +5,8 @@ import importlib.metadata
|
|||||||
import pkgutil
|
import pkgutil
|
||||||
import chromadb
|
import chromadb
|
||||||
from chromadb import Settings
|
from chromadb import Settings
|
||||||
from base64 import b64encode
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from typing import TypeVar, Generic, Union
|
from typing import TypeVar, Generic
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@ -19,7 +18,6 @@ import markdown
|
|||||||
import requests
|
import requests
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
from secrets import token_bytes
|
|
||||||
from constants import ERROR_MESSAGES
|
from constants import ERROR_MESSAGES
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
@ -768,12 +766,14 @@ class BannerModel(BaseModel):
|
|||||||
dismissible: bool
|
dismissible: bool
|
||||||
timestamp: int
|
timestamp: int
|
||||||
|
|
||||||
|
try:
|
||||||
|
banners = json.loads(os.environ.get("WEBUI_BANNERS", "[]"))
|
||||||
|
banners = [BannerModel(**banner) for banner in banners]
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error loading WEBUI_BANNERS: {e}")
|
||||||
|
banners = []
|
||||||
|
|
||||||
WEBUI_BANNERS = PersistentConfig(
|
WEBUI_BANNERS = PersistentConfig("WEBUI_BANNERS", "ui.banners", banners)
|
||||||
"WEBUI_BANNERS",
|
|
||||||
"ui.banners",
|
|
||||||
[BannerModel(**banner) for banner in json.loads("[]")],
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
SHOW_ADMIN_DETAILS = PersistentConfig(
|
SHOW_ADMIN_DETAILS = PersistentConfig(
|
||||||
|
Loading…
Reference in New Issue
Block a user