Files
archie/ui/src/settings/model-choices.ts
T
sam 230280a6e0 feat(webui): Models picks from the provider catalog, and enables available providers
archied already finds usable providers (key set in the environment, or
configured) through the model catalog; the published config view now
carries that catalog, providers with their model ids. Settings > Models
offers role models only from configured providers, lists the catalog's
unconfigured providers as available, and adding one carries its class, key
variable and endpoint. Roles and providers are two accordions, each ending
in an add row.
2026-09-25 18:04:46 +10:00

16 lines
721 B
TypeScript

import type { CatalogProvider } from "./types.ts";
/** roleModelOptions lists "provider/model" for every model of a configured
* provider: a role can only run on a provider Archie is set up to call. */
export function roleModelOptions(catalog: CatalogProvider[], configured: string[]): string[] {
return catalog
.filter((p) => configured.includes(p.id))
.flatMap((p) => p.models.map((m) => `${p.id}/${m}`));
}
/** availableProviders is what the catalog found usable but is not configured
* yet, the providers Settings offers to enable. */
export function availableProviders(catalog: CatalogProvider[], configured: string[]): CatalogProvider[] {
return catalog.filter((p) => !configured.includes(p.id));
}