( config: ManagedKimiConfigShape, platformId: string, )
| 218 | } |
| 219 | |
| 220 | export 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 | } |
no test coverage detected