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

Function stripProvider

apps/kimi-code/scripts/update-catalog.mjs:50–68  ·  view source on GitHub ↗
(provider)

Source from the content-addressed store, hash-verified

48}
49
50function stripProvider(provider) {
51 if (typeof provider !== "object" || provider === null) return undefined;
52 const result = {};
53 for (const key of Object.keys(provider)) {
54 if (!KEEP_PROVIDER.has(key)) continue;
55 const value = provider[key];
56 if (key === "models") {
57 const stripped = {};
58 for (const [mId, m] of Object.entries(value)) {
59 const s = stripModel(m);
60 if (s !== undefined) stripped[mId] = s;
61 }
62 if (Object.keys(stripped).length > 0) result[key] = stripped;
63 } else {
64 result[key] = value;
65 }
66 }
67 return result;
68}
69
70async function fetchCatalog(url) {
71 const res = await fetch(url, { headers: { Accept: "application/json" } });

Callers 1

fetchCatalogFunction · 0.85

Calls 3

stripModelFunction · 0.85
keysMethod · 0.80
hasMethod · 0.65

Tested by

no test coverage detected