Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
f69c0d2e
Unverified
Commit
f69c0d2e
authored
Feb 23, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
Feb 23, 2024
Browse files
Merge pull request #883 from open-webui/custom-name
fix: error handling
parents
1f6b3488
d1f170dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
17 deletions
+21
-17
backend/config.py
backend/config.py
+21
-17
No files found.
backend/config.py
View file @
f69c0d2e
...
...
@@ -106,23 +106,27 @@ CHANGELOG = changelog_json
CUSTOM_NAME
=
os
.
environ
.
get
(
"CUSTOM_NAME"
,
""
)
if
CUSTOM_NAME
:
r
=
requests
.
get
(
f
"https://api.openwebui.com/api/v1/custom/
{
CUSTOM_NAME
}
"
)
data
=
r
.
json
()
if
"logo"
in
data
:
url
=
(
f
"https://api.openwebui.com
{
data
[
'logo'
]
}
"
if
data
[
"logo"
][
0
]
==
"/"
else
data
[
"logo"
]
)
r
=
requests
.
get
(
url
,
stream
=
True
)
if
r
.
status_code
==
200
:
with
open
(
"./static/favicon.png"
,
"wb"
)
as
f
:
r
.
raw
.
decode_content
=
True
shutil
.
copyfileobj
(
r
.
raw
,
f
)
WEBUI_NAME
=
data
[
"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'
]
}
"
if
data
[
"logo"
][
0
]
==
"/"
else
data
[
"logo"
]
)
r
=
requests
.
get
(
url
,
stream
=
True
)
if
r
.
status_code
==
200
:
with
open
(
"./static/favicon.png"
,
"wb"
)
as
f
:
r
.
raw
.
decode_content
=
True
shutil
.
copyfileobj
(
r
.
raw
,
f
)
WEBUI_NAME
=
data
[
"name"
]
except
Exception
as
e
:
print
(
e
)
pass
####################################
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment