fix(ui/model-hub): render provider icons on the public model hub (#29958)

The provider logo base path was relative ("../ui/assets/logos/"). With
trailingSlash enabled, the public model hub is served at /ui/model_hub_table/,
so the browser resolved the base to /ui/ui/assets/logos/ (a doubled /ui/), which
404s every icon. The authenticated hub renders inside the single-level /ui/ SPA
route where the relative path resolves correctly, so only the public hub broke.
Make the base root-absolute so it resolves at any route depth.
This commit is contained in:
yuneng-jiang 2026-06-08 12:12:07 -07:00 committed by GitHub
parent ff6cea4833
commit 26fe26a5c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 1 deletions

View File

@ -97,6 +97,27 @@ describe("provider_info_helpers", () => {
});
});
describe("provider logo asset paths", () => {
// Regression: a relative "../ui/assets/logos/" base resolved to
// "/ui/ui/assets/logos/..." (404) on the public model hub at
// /ui/model_hub_table/, which sits a level below the /ui/ SPA. Root-absolute
// paths resolve correctly at any route depth.
it("should expose every provider logo as a root-absolute /ui path", () => {
const logos = Object.values(providerLogoMap);
expect(logos.length).toBeGreaterThan(0);
logos.forEach((logo) => {
expect(logo.startsWith("/ui/assets/logos/")).toBe(true);
expect(logo).not.toContain("../");
});
});
it("should resolve a provider logo to a root-absolute path via getProviderLogoAndName", () => {
const { logo } = getProviderLogoAndName("openai");
expect(logo.startsWith("/ui/assets/logos/")).toBe(true);
expect(logo).not.toContain("../");
});
});
describe("getPlaceholder", () => {
it("should return aiml placeholder for AIML provider", () => {
expect(getPlaceholder(Providers.AIML)).toBe("aiml/flux-pro/v1.1");

View File

@ -216,7 +216,7 @@ export const provider_map: Record<string, string> = {
ZAI: "zai",
};
const asset_logos_folder = "../ui/assets/logos/";
const asset_logos_folder = "/ui/assets/logos/";
export const providerLogoMap: Record<string, string> = {
[Providers.A2A_Agent]: `${asset_logos_folder}a2a_agent.png`,