feat: unify provider active logic and add env field support for kimi_code_io

This commit is contained in:
KimiSwitch Dev
2026-07-09 08:44:11 +08:00
parent 3b12844342
commit b01a5661b4
6 changed files with 44 additions and 25 deletions
+4 -3
View File
@@ -87,12 +87,13 @@ fn active_provider_and_model(config: &Config) -> Option<(String, String)> {
}
fn build_active_config(config: &Config) -> Config {
let is_kimi_native = |p: &Provider| p.managed;
// Only the provider explicitly marked as active is written to the agent's
// native config. This ensures Kimi Code / Pi follow Pi Switch's choice
// instead of falling back to a managed/native provider.
let providers: IndexMap<String, Provider> = config
.providers
.iter()
.filter(|(_, p)| is_kimi_native(p) || p.active)
.filter(|(_, p)| p.active)
.map(|(k, p)| (k.clone(), p.clone()))
.collect();