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

Function removeOpenPlatformConfig

packages/oauth/src/open-platform.ts:220–242  ·  view source on GitHub ↗
(
  config: ManagedKimiConfigShape,
  platformId: string,
)

Source from the content-addressed store, hash-verified

218}
219
220export function removeOpenPlatformConfig(
221 config: ManagedKimiConfigShape,
222 platformId: string,
223): void {
224 delete config.providers[platformId];
225
226 let removedDefault = false;
227 const existingModels = config.models ?? {};
228 for (const [key, model] of Object.entries(existingModels)) {
229 if (!isRecord(model) || model['provider'] !== platformId) continue;
230 delete existingModels[key];
231 if (config.defaultModel === key) removedDefault = true;
232 }
233 config.models = existingModels;
234
235 if (removedDefault) {
236 config.defaultModel = undefined;
237 }
238
239 if (config['defaultProvider'] === platformId) {
240 config['defaultProvider'] = undefined;
241 }
242}

Callers 1

Calls 1

isRecordFunction · 0.90

Tested by

no test coverage detected