mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-11-17 09:31:45 +00:00
Every run page asked for the provider catalog, though only a failed or dead run's banner uses it. useProviders takes an enabled flag, and the id-to-display-name map settings-models built by hand is now providerNamesById, shared with the run page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
20 lines
674 B
TypeScript
20 lines
674 B
TypeScript
import type { Model, Provider } from "@qltysh/fabro-api-client";
|
|
|
|
type ModelOfferingIdentity = Pick<Model, "provider" | "id">;
|
|
|
|
export function modelOfferingKey(model: ModelOfferingIdentity): string {
|
|
return `${model.provider}\u0000${model.id}`;
|
|
}
|
|
|
|
/** Provider ids to the names the catalog displays, falling back to the id. */
|
|
export function providerNamesById(
|
|
providers: readonly Pick<Provider, "id" | "display_name">[],
|
|
): Map<string, string> {
|
|
return new Map(providers.map((p) => [p.id, p.display_name || p.id]));
|
|
}
|
|
|
|
export function modelOfferingTestArgs(
|
|
model: ModelOfferingIdentity,
|
|
): [id: string, provider: string] {
|
|
return [model.id, model.provider];
|
|
}
|