Merge pull request #883 from open-webui/custom-name

fix: error handling
This commit is contained in:
Timothy Jaeryang Baek 2024-02-23 20:37:22 -05:00 committed by GitHub
commit f69c0d2e85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 19 additions and 15 deletions

View File

@ -106,9 +106,10 @@ CHANGELOG = changelog_json
CUSTOM_NAME = os.environ.get("CUSTOM_NAME", "")
if CUSTOM_NAME:
try:
r = requests.get(f"https://api.openwebui.com/api/v1/custom/{CUSTOM_NAME}")
data = r.json()
if r.ok:
if "logo" in data:
url = (
f"https://api.openwebui.com{data['logo']}"
@ -123,6 +124,9 @@ if CUSTOM_NAME:
shutil.copyfileobj(r.raw, f)
WEBUI_NAME = data["name"]
except Exception as e:
print(e)
pass
####################################