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

Function removeCustomRegistryProvider

packages/oauth/src/custom-registry.ts:342–364  ·  view source on GitHub ↗
(
  config: ManagedKimiConfigShape,
  providerId: string,
)

Source from the content-addressed store, hash-verified

340 * `removeOpenPlatformConfig`.
341 */
342export function removeCustomRegistryProvider(
343 config: ManagedKimiConfigShape,
344 providerId: string,
345): void {
346 delete config.providers[providerId];
347
348 let removedDefault = false;
349 const existingModels = config.models ?? {};
350 for (const [key, alias] of Object.entries(existingModels)) {
351 if (!isRecord(alias) || alias['provider'] !== providerId) continue;
352 delete existingModels[key];
353 if (config.defaultModel === key) removedDefault = true;
354 }
355 config.models = existingModels;
356
357 if (removedDefault) {
358 config.defaultModel = undefined;
359 }
360
361 if (config['defaultProvider'] === providerId) {
362 config['defaultProvider'] = undefined;
363 }
364}
365
366/**
367 * Applies every entry from a single api.json import in memory. Mirrors the

Callers 3

refreshProviderModelsFunction · 0.90

Calls 1

isRecordFunction · 0.90

Tested by

no test coverage detected