This commit is contained in:
Michael Poluektov 2024-07-03 10:07:46 +01:00
commit 49b4211c06
3 changed files with 13 additions and 13 deletions

View File

@ -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(

View File

@ -40,7 +40,7 @@ sentence-transformers==3.0.1
pypdf==4.2.0 pypdf==4.2.0
docx2txt==0.8 docx2txt==0.8
python-pptx==0.6.23 python-pptx==0.6.23
unstructured==0.14.0 unstructured==0.14.9
Markdown==3.6 Markdown==3.6
pypandoc==1.13 pypandoc==1.13
pandas==2.2.2 pandas==2.2.2

View File

@ -480,18 +480,18 @@
<!-- {valves[property]} --> <!-- {valves[property]} -->
<div class="flex mt-0.5 mb-1.5 space-x-2"> <div class="flex mt-0.5 mb-1.5 space-x-2">
<div class=" flex-1"> <div class=" flex-1">
{#if valvesSpec.properties[property]?.enum ?? null} {#if valves_spec.properties[property]?.enum ?? null}
<select <select
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none" class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
bind:value={valves[property]} bind:value={valves[property]}
> >
{#each valvesSpec.properties[property].enum as option} {#each valves_spec.properties[property].enum as option}
<option value={option} selected={option === valves[property]}> <option value={option} selected={option === valves[property]}>
{option} {option}
</option> </option>
{/each} {/each}
</select> </select>
{:else if (valvesSpec.properties[property]?.type ?? null) === 'boolean'} {:else if (valves_spec.properties[property]?.type ?? null) === 'boolean'}
<div class="flex justify-between items-center"> <div class="flex justify-between items-center">
<div class="text-xs text-gray-500"> <div class="text-xs text-gray-500">
{valves[property] ? 'Enabled' : 'Disabled'} {valves[property] ? 'Enabled' : 'Disabled'}
@ -505,7 +505,7 @@
<input <input
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none" class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
type="text" type="text"
placeholder={valvesSpec.properties[property].title} placeholder={valves_spec.properties[property].title}
bind:value={valves[property]} bind:value={valves[property]}
autocomplete="off" autocomplete="off"
required required