MCPcopy Index your code
hub / github.com/sourcebot-dev/sourcebot / loadCatalog

Function loadCatalog

packages/setupWizard/src/models.ts:58–75  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

56let catalogPromise: Promise<ModelsDevCatalog | null> | null = null;
57
58async function loadCatalog(): Promise<ModelsDevCatalog | null> {
59 if (!catalogPromise) {
60 catalogPromise = (async () => {
61 try {
62 const response = await fetch(MODELS_DEV_API_URL, {
63 signal: AbortSignal.timeout(FETCH_TIMEOUT_MS),
64 });
65 if (!response.ok) {
66 return null;
67 }
68 return await response.json() as ModelsDevCatalog;
69 } catch {
70 return null;
71 }
72 })();
73 }
74 return catalogPromise;
75}
76
77async function getModelOptionsForProvider(providerKey: string): Promise<ModelOption[] | null> {
78 const catalog = await loadCatalog();

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected