"...git@developer.sourcefind.cn:chenpangpang/open-webui.git" did not exist on "07d2c9871ff53567a924602d7e2764b4a484e558"
Commit d1f170dc authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

fix: error handling

parent decba05c
...@@ -106,23 +106,27 @@ CHANGELOG = changelog_json ...@@ -106,23 +106,27 @@ CHANGELOG = changelog_json
CUSTOM_NAME = os.environ.get("CUSTOM_NAME", "") CUSTOM_NAME = os.environ.get("CUSTOM_NAME", "")
if CUSTOM_NAME: if CUSTOM_NAME:
r = requests.get(f"https://api.openwebui.com/api/v1/custom/{CUSTOM_NAME}") try:
data = r.json() r = requests.get(f"https://api.openwebui.com/api/v1/custom/{CUSTOM_NAME}")
data = r.json()
if "logo" in data: if r.ok:
url = ( if "logo" in data:
f"https://api.openwebui.com{data['logo']}" url = (
if data["logo"][0] == "/" f"https://api.openwebui.com{data['logo']}"
else data["logo"] if data["logo"][0] == "/"
) else data["logo"]
)
r = requests.get(url, stream=True)
if r.status_code == 200: r = requests.get(url, stream=True)
with open("./static/favicon.png", "wb") as f: if r.status_code == 200:
r.raw.decode_content = True with open("./static/favicon.png", "wb") as f:
shutil.copyfileobj(r.raw, f) r.raw.decode_content = True
shutil.copyfileobj(r.raw, f)
WEBUI_NAME = data["name"]
WEBUI_NAME = data["name"]
except Exception as e:
print(e)
pass
#################################### ####################################
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment