feat: banners

Co-Authored-By: Jun Siang Cheah <me@jscheah.me>
This commit is contained in:
Timothy J. Baek
2024-05-26 12:18:43 -07:00
parent 00f32e2651
commit 242d4f0c8d
11 changed files with 461 additions and 1 deletions

View File

@@ -8,6 +8,8 @@ from chromadb import Settings
from base64 import b64encode
from bs4 import BeautifulSoup
from typing import TypeVar, Generic, Union
from pydantic import BaseModel
from typing import Optional
from pathlib import Path
import json
@@ -566,6 +568,22 @@ WEBHOOK_URL = PersistentConfig(
ENABLE_ADMIN_EXPORT = os.environ.get("ENABLE_ADMIN_EXPORT", "True").lower() == "true"
class BannerModel(BaseModel):
id: str
type: str
title: Optional[str] = None
content: str
dismissible: bool
timestamp: int
WEBUI_BANNERS = PersistentConfig(
"WEBUI_BANNERS",
"ui.banners",
[BannerModel(**banner) for banner in json.loads("[]")],
)
####################################
# WEBUI_SECRET_KEY
####################################