Spaces:
Sleeping
Sleeping
Download src/shared/utils/providerIcon.js from automindy/sdkongwang: direct link, hf CLI and curl.
- Browser
- Download file 1.33 kB
-
https://huggingface.co/spaces/automindy/sdkongwang/resolve/main/src/shared/utils/providerIcon.js
- Command line
-
hf download hf://spaces/automindy/sdkongwang/src/shared/utils/providerIcon.js
-
curl -L -o providerIcon.js https://huggingface.co/spaces/automindy/sdkongwang/resolve/main/src/shared/utils/providerIcon.js
1.33 kB
| // Provider icon paths under /public/providers. | |
| // Alias related brands; session-cache 404s so one miss never spams again. | |
| const ICON_ALIASES = { | |
| "perplexity-agent": "perplexity", | |
| "gitlab-duo": "gitlab", | |
| "vercel-ai-gateway": "vercel", | |
| }; | |
| // Runtime only — first 404 remembers id for the whole session | |
| const failedIds = new Set(); | |
| function normalizeId(providerId) { | |
| if (!providerId || typeof providerId !== "string") return ""; | |
| return providerId.trim().toLowerCase(); | |
| } | |
| /** Resolve icon file id (after alias). Empty if previously failed this session. */ | |
| export function resolveProviderIconId(providerId) { | |
| const id = normalizeId(providerId); | |
| if (!id) return ""; | |
| if (failedIds.has(id)) return ""; | |
| const aliased = ICON_ALIASES[id] || id; | |
| if (failedIds.has(aliased)) return ""; | |
| return aliased; | |
| } | |
| /** `/providers/{id}.png` or null when previously failed. */ | |
| export function getProviderIconSrc(providerId) { | |
| const id = resolveProviderIconId(providerId); | |
| return id ? `/providers/${id}.png` : null; | |
| } | |
| /** Call from img onError so later mounts skip the request. */ | |
| export function markProviderIconMissing(providerId) { | |
| const id = normalizeId(providerId); | |
| if (id) failedIds.add(id); | |
| const aliased = ICON_ALIASES[id]; | |
| if (aliased) failedIds.add(aliased); | |
| } | |