forked from open-webui/open-webui
fix: error handling
This commit is contained in:
parent
decba05c7a
commit
d1f170dc77
1 changed files with 19 additions and 15 deletions
|
@ -106,9 +106,10 @@ CHANGELOG = changelog_json
|
||||||
|
|
||||||
CUSTOM_NAME = os.environ.get("CUSTOM_NAME", "")
|
CUSTOM_NAME = os.environ.get("CUSTOM_NAME", "")
|
||||||
if CUSTOM_NAME:
|
if CUSTOM_NAME:
|
||||||
|
try:
|
||||||
r = requests.get(f"https://api.openwebui.com/api/v1/custom/{CUSTOM_NAME}")
|
r = requests.get(f"https://api.openwebui.com/api/v1/custom/{CUSTOM_NAME}")
|
||||||
data = r.json()
|
data = r.json()
|
||||||
|
if r.ok:
|
||||||
if "logo" in data:
|
if "logo" in data:
|
||||||
url = (
|
url = (
|
||||||
f"https://api.openwebui.com{data['logo']}"
|
f"https://api.openwebui.com{data['logo']}"
|
||||||
|
@ -123,6 +124,9 @@ if CUSTOM_NAME:
|
||||||
shutil.copyfileobj(r.raw, f)
|
shutil.copyfileobj(r.raw, f)
|
||||||
|
|
||||||
WEBUI_NAME = data["name"]
|
WEBUI_NAME = data["name"]
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
|
|
Loading…
Reference in a new issue