Spaces:
Runtime error
Runtime error
Download src/lib/utils/models.ts from evijit/pluralchat: direct link, hf CLI and curl.
- Browser
- Download file 481 Bytes
-
https://huggingface.co/spaces/evijit/pluralchat/resolve/refs%2Fpr%2F1/src/lib/utils/models.ts
- Command line
-
hf download hf://spaces/evijit/pluralchat@refs/pr/1/src/lib/utils/models.ts
-
curl -L -o models.ts https://huggingface.co/spaces/evijit/pluralchat/resolve/refs%2Fpr%2F1/src/lib/utils/models.ts
481 Bytes
| import type { Model } from "$lib/types/Model"; | |
| export const findCurrentModel = ( | |
| models: Model[], | |
| oldModels: { id: string; transferTo?: string }[] = [], | |
| id?: string | |
| ): Model => { | |
| if (id) { | |
| const direct = models.find((m) => m.id === id); | |
| if (direct) return direct; | |
| const legacy = oldModels.find((m) => m.id === id); | |
| if (legacy?.transferTo) { | |
| const mapped = models.find((m) => m.id === legacy.transferTo); | |
| if (mapped) return mapped; | |
| } | |
| } | |
| return models[0]; | |
| }; | |