mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-24 05:45:11 +00:00
fix(ui): preserve favicon prefix in exported router payloads
This commit is contained in:
parent
c137ad01ce
commit
6f82d81bd5
2 changed files with 3 additions and 1 deletions
|
|
@ -32,6 +32,7 @@ class TestUIRootPath(unittest.TestCase):
|
|||
'<script src="/litellm-asset-prefix/_next/app.js"></script>'
|
||||
'<img src="/ui/assets/logo.png"></body></html>'
|
||||
)
|
||||
(source / "index.txt").write_text('[{"href":"/favicon.ico?version=1"}]')
|
||||
(source / "app.js").write_text('fetch("/litellm/.well-known/litellm-ui-config")')
|
||||
(source / "font.woff2").write_bytes(bytes(range(256)))
|
||||
return source
|
||||
|
|
@ -50,6 +51,7 @@ class TestUIRootPath(unittest.TestCase):
|
|||
self.assertIn('href="/services/llm/get_favicon"', (runtime / "index.html").read_text())
|
||||
self.assertIn('href="/services/llm/favicon.ico?version=1"', (runtime / "index.html").read_text())
|
||||
self.assertIn('src="/services/llm/ui/assets/logo.png"', (runtime / "index.html").read_text())
|
||||
self.assertIn("/services/llm/favicon.ico?version=1", (runtime / "index.txt").read_text())
|
||||
self.assertEqual(runtime.stat().st_mode & 0o005, 0o005)
|
||||
self.assertEqual((runtime / "index.html").stat().st_mode & 0o004, 0o004)
|
||||
self.assertIn("/services/llm/.well-known/litellm-ui-config", (runtime / "app.js").read_text())
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@ if [ -n "$prefix" ]; then
|
|||
for file do
|
||||
sed -e "s|/litellm-asset-prefix|$prefix|g" \
|
||||
-e "s|/litellm/\.well-known/litellm-ui-config|$prefix/.well-known/litellm-ui-config|g" \
|
||||
-e "s|/favicon.ico|$prefix/favicon.ico|g" \
|
||||
"$file" > "$file.tmp"
|
||||
case "$file" in
|
||||
*.html)
|
||||
sed -e "s|<head>|<head><meta name=\"litellm-server-root-path\" content=\"$prefix\">|g" \
|
||||
-e "s|src=\"/ui/assets/|src=\"$prefix/ui/assets/|g" \
|
||||
-e "s|href=\"/get_favicon\"|href=\"$prefix/get_favicon\"|g" \
|
||||
-e "s|href=\"/favicon.ico|href=\"$prefix/favicon.ico|g" \
|
||||
"$file.tmp" > "$file"
|
||||
rm "$file.tmp"
|
||||
;;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue