From 16fa45455850a8218e0c0d63f96ff8733900318c Mon Sep 17 00:00:00 2001 From: Michael Poluektov Date: Tue, 2 Jul 2024 14:17:36 +0100 Subject: [PATCH 1/4] fix banners env --- backend/config.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/backend/config.py b/backend/config.py index d6efde563..4a7456fd2 100644 --- a/backend/config.py +++ b/backend/config.py @@ -5,10 +5,10 @@ import importlib.metadata import pkgutil import chromadb from chromadb import Settings -from base64 import b64encode from bs4 import BeautifulSoup -from typing import TypeVar, Generic, Union +from typing import TypeVar, Generic from pydantic import BaseModel +from pydantic.error_wrappers import ValidationError from typing import Optional from pathlib import Path @@ -19,7 +19,6 @@ import markdown import requests import shutil -from secrets import token_bytes from constants import ERROR_MESSAGES #################################### @@ -768,12 +767,14 @@ class BannerModel(BaseModel): dismissible: bool timestamp: int +try: + banners = json.loads(os.environ.get("WEBUI_BANNERS", "[]")) + banners = [BannerModel(**banner) for banner in banners] +except ValidationError as e: + print(f"Error loading WEBUI_BANNERS: {e}") + banners = [] -WEBUI_BANNERS = PersistentConfig( - "WEBUI_BANNERS", - "ui.banners", - [BannerModel(**banner) for banner in json.loads("[]")], -) +WEBUI_BANNERS = PersistentConfig("WEBUI_BANNERS", "ui.banners", banners) SHOW_ADMIN_DETAILS = PersistentConfig( From 655238dcd7b71e43c7f48e30d8e7e51c56904084 Mon Sep 17 00:00:00 2001 From: Michael Poluektov Date: Tue, 2 Jul 2024 14:41:59 +0100 Subject: [PATCH 2/4] banners: generic exception --- backend/config.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/backend/config.py b/backend/config.py index 4a7456fd2..2fcc0ba64 100644 --- a/backend/config.py +++ b/backend/config.py @@ -8,7 +8,6 @@ from chromadb import Settings from bs4 import BeautifulSoup from typing import TypeVar, Generic from pydantic import BaseModel -from pydantic.error_wrappers import ValidationError from typing import Optional from pathlib import Path @@ -770,7 +769,7 @@ class BannerModel(BaseModel): try: banners = json.loads(os.environ.get("WEBUI_BANNERS", "[]")) banners = [BannerModel(**banner) for banner in banners] -except ValidationError as e: +except Exception as e: print(f"Error loading WEBUI_BANNERS: {e}") banners = [] From cf317f8fdf0c31bd66e512b080c4f98037bc302d Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 2 Jul 2024 15:20:50 -0700 Subject: [PATCH 3/4] fix --- src/lib/components/admin/Settings/Pipelines.svelte | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/components/admin/Settings/Pipelines.svelte b/src/lib/components/admin/Settings/Pipelines.svelte index 22ebc707c..c9a464c2a 100644 --- a/src/lib/components/admin/Settings/Pipelines.svelte +++ b/src/lib/components/admin/Settings/Pipelines.svelte @@ -480,18 +480,18 @@
- {#if valvesSpec.properties[property]?.enum ?? null} + {#if valves_spec.properties[property]?.enum ?? null} - {:else if (valvesSpec.properties[property]?.type ?? null) === 'boolean'} + {:else if (valves_spec.properties[property]?.type ?? null) === 'boolean'}
{valves[property] ? 'Enabled' : 'Disabled'} @@ -505,7 +505,7 @@ Date: Tue, 2 Jul 2024 16:08:03 -0700 Subject: [PATCH 4/4] chore: bump --- backend/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/requirements.txt b/backend/requirements.txt index 53c5fbc81..750298456 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -40,7 +40,7 @@ sentence-transformers==3.0.1 pypdf==4.2.0 docx2txt==0.8 python-pptx==0.6.23 -unstructured==0.14.0 +unstructured==0.14.9 Markdown==3.6 pypandoc==1.13 pandas==2.2.2