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:
parent
ff6cea4833
commit
26fe26a5c0
@ -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");
|
||||
|
||||
@ -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`,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user