MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / fetchCatalog

Function fetchCatalog

apps/kimi-code/scripts/update-catalog.mjs:70–83  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

68}
69
70async function fetchCatalog(url) {
71 const res = await fetch(url, { headers: { Accept: "application/json" } });
72 if (!res.ok) throw new Error(`HTTP ${res.status}`);
73 const raw = await res.json();
74 if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
75 throw new Error("invalid payload shape");
76 }
77 const stripped = {};
78 for (const [k, v] of Object.entries(raw)) {
79 const p = stripProvider(v);
80 if (p !== undefined && Object.keys(p).length > 0) stripped[k] = p;
81 }
82 return JSON.stringify(stripped);
83}
84
85async function main() {
86 console.log(`Fetching ${modelsUrl} ...`);

Callers 3

mainFunction · 0.70
handleCatalogProviderAddFunction · 0.50
loadCatalogOrExitFunction · 0.50

Calls 3

stripProviderFunction · 0.85
jsonMethod · 0.80
keysMethod · 0.80

Tested by

no test coverage detected