( config: ManagedKimiConfigShape, providerId: string, )
| 340 | * `removeOpenPlatformConfig`. |
| 341 | */ |
| 342 | export 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 |
no test coverage detected