Skip to content

Conversation

@justalittleadam
Copy link

@justalittleadam justalittleadam commented Dec 12, 2025

Title

Add /ui Logo .svg file support

Relevant issues

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🧹 Refactoring
✅ Test

Changes

What this PR changes (SVG logo support)

Adds SVG/SVGZ MIME handling helpers
New litellm/proxy/common_utils/logo_utils.py provides:

infer_logo_content_type() to detect image/svg+xml for .svg / .svgz (and mark .svgz as gzip-encoded).
normalize_logo_content_type() to normalize headers like image/svg → image/svg+xml (and image/jpg → image/jpeg).
cache_extension_for_logo() to choose the right cache filename extension (.svg, .svgz, or a best-effort extension for other image types).
Fixes /get_image to return correct Content-Type for SVG
In litellm/proxy/proxy_server.py, /get_image now:

Returns media_type="image/svg+xml" for local UI_LOGO_PATH pointing to .svg/.svgz instead of always image/jpeg.
For remote logos (HTTP/HTTPS), reads Content-Type from the response when present, otherwise infers it from the URL path.
Caches remote logos using the correct extension (cached_logo.svg / cached_logo.svgz), rather than always writing cached_logo.jpg.
Preserves Content-Encoding: gzip when serving .svgz (so browsers can decode it correctly).
Adds tests for the new behavior
In tests/test_litellm/proxy/test_proxy_server.py, adds mocked tests that verify:

Local Unit Test Passing:
Full file run:

Screenshot 2025-12-12 at 12 41 06 PM

Specific unit test added passing:

Screenshot 2025-12-12 at 12 43 00 PM

Evidence of the Update:

Before SVG ui Handling (overriding UI_LOGO param with a link to a local .svg):
Screenshot 2025-12-12 at 11 45 45 AM

After Svg Handling: (the purple circular "LLM" image).
Screenshot 2025-12-12 at 11 17 37 AM

A NOTE TO REVIEWER:

Locally, linting failed with

proxy/custom_prompt_management.py:40: error: Cannot instantiate abstract class "X42PromptManagement" with abstract attribute "async_compile_prompt_helper"  [abstract]
Found 36 errors in 16 files (checked 1472 source files)

I also witnessed this happen in your automation pipeline, as well as running linting in a direct clone from main. I do not believe this failure is related to my change, but, rather, something else in the codebase.

also, locally running format updated around 673 files. I did not change those 673 files. i witnessed the same behavior when comparing in main. running make format in main resulted in the same (673) files reformatted. Again, i dont believe this is related to my change.

Additionally, i am noticing the custom prompt management unit tests are failing.

Primary commit to review:
8bbe112

@vercel
Copy link

vercel bot commented Dec 12, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
litellm Ready Ready Preview, Comment Dec 13, 2025 2:19am

@justalittleadam justalittleadam changed the title Feature/svg logo support adding support for .svg files in UI logo UI_LOGO param override for admin panel Dec 12, 2025
# Conflicts:
#	litellm/proxy/_experimental/out/_next/static/chunks/1200-64d099608f321062.js
#	litellm/proxy/_experimental/out/_next/static/chunks/2249-985208cb7064c804.js
#	litellm/proxy/_experimental/out/_next/static/chunks/6609-d93906f43161f066.js
#	litellm/proxy/_experimental/out/_next/static/chunks/7526-997a4faae4b21df5.js
#	litellm/proxy/_experimental/out/_next/static/chunks/7641-90e15c72e10330f1.js
#	litellm/proxy/_experimental/out/_next/static/chunks/766-baf0336e8ba5c686.js
#	litellm/proxy/_experimental/out/_next/static/chunks/8049-8ef1e898a3048691.js
#	litellm/proxy/_experimental/out/_next/static/chunks/8093-e09634b69e09143b.js
#	litellm/proxy/_experimental/out/_next/static/chunks/8143-cd64b2e17d72ff26.js
#	litellm/proxy/_experimental/out/_next/static/chunks/9878-52c3826c6d453296.js
#	litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/experimental/api-playground/page-06a63a5f39095f92.js
#	litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/layout-924e12ba5dd777b7.js
#	litellm/proxy/_experimental/out/experimental/api-playground.html
#	litellm/proxy/_experimental/out/experimental/budgets.html
#	litellm/proxy/_experimental/out/experimental/caching.html
#	litellm/proxy/_experimental/out/experimental/old-usage.html
#	litellm/proxy/_experimental/out/experimental/prompts.html
#	litellm/proxy/_experimental/out/experimental/tag-management.html
#	litellm/proxy/_experimental/out/login/index.html
#	litellm/proxy/_experimental/out/mcp/oauth/callback.html
#	litellm/proxy/_experimental/out/model_hub_table/index.html
#	litellm/proxy/_experimental/out/models-and-endpoints/index.html
#	litellm/proxy/_experimental/out/playground/index.html
#	litellm/proxy/_experimental/out/settings/admin-settings.html
#	litellm/proxy/_experimental/out/settings/logging-and-alerts.html
#	litellm/proxy/_experimental/out/settings/router-settings.html
#	litellm/proxy/_experimental/out/settings/ui-theme.html
#	litellm/proxy/_experimental/out/test-key/index.html
#	litellm/proxy/_experimental/out/tools/mcp-servers.html
#	litellm/proxy/_experimental/out/tools/vector-stores.html
#	litellm/proxy/_experimental/out/usage/index.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant