mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-25 13:45:03 +08:00
refactor(codex): unify custom model_provider routing key to "custom"
- Always emit `model_provider = "custom"` from deep link, UniversalProvider, and the universal form modal so future writes share one stable routing key. - Add `codex_provider_template_v1` local migration that rewrites legacy keys (aihubmix/ccswitch/...) under `[model_providers.custom]`, updates profile refs, and backs up the original settings_config under `~/.cc-switch/backups/<timestamp>/providers/`. - Tighten history migration source detection to a whitelist plus `[model_providers.<id>]` existence check so user-authored keys are never rewritten in jsonl/state DB. - Encode deep link name/model/endpoint through `toml_edit::Value` so display names containing quotes or backslashes no longer break the generated config.toml. - Stabilize provider settings backup filename hash with Sha256 (was process-random SipHash).
This commit is contained in:
@@ -558,6 +558,24 @@ pub fn run() {
|
||||
log::warn!("✗ Codex history provider bucket migration failed: {e}");
|
||||
}
|
||||
}
|
||||
|
||||
match crate::codex_history_migration::maybe_migrate_codex_provider_template_bucket(
|
||||
&db_for_codex_history_migration,
|
||||
) {
|
||||
Ok(outcome) => {
|
||||
if let Some(reason) = outcome.skipped_reason {
|
||||
log::debug!("○ Codex provider template bucket migration skipped: {reason}");
|
||||
} else if !outcome.migrated_provider_ids.is_empty() {
|
||||
log::info!(
|
||||
"✓ Codex provider template bucket migration completed: providers={}",
|
||||
outcome.migrated_provider_ids.len()
|
||||
);
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
log::warn!("✗ Codex provider template bucket migration failed: {e}");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user