Spaces:
Paused
Paused
Download ui/src/lib/model-utils.ts from testfirela/paperclip-app: direct link, hf CLI and curl.
- Browser
- Download file 585 Bytes
-
https://huggingface.co/spaces/testfirela/paperclip-app/resolve/main/ui/src/lib/model-utils.ts
- Command line
-
hf download hf://spaces/testfirela/paperclip-app/ui/src/lib/model-utils.ts
-
curl -L -o model-utils.ts https://huggingface.co/spaces/testfirela/paperclip-app/resolve/main/ui/src/lib/model-utils.ts
585 Bytes
| export function extractProviderId(modelId: string): string | null { | |
| const trimmed = modelId.trim(); | |
| if (!trimmed.includes("/")) return null; | |
| const provider = trimmed.slice(0, trimmed.indexOf("/")).trim(); | |
| return provider || null; | |
| } | |
| export function extractProviderIdWithFallback(modelId: string, fallback = "other"): string { | |
| return extractProviderId(modelId) ?? fallback; | |
| } | |
| export function extractModelName(modelId: string): string { | |
| const trimmed = modelId.trim(); | |
| if (!trimmed.includes("/")) return trimmed; | |
| return trimmed.slice(trimmed.indexOf("/") + 1).trim(); | |
| } | |