diff --git a/apps/codex-plus-manager/src-tauri/tests/windows_subsystem.rs b/apps/codex-plus-manager/src-tauri/tests/windows_subsystem.rs index 51fe563a..f7944a8d 100644 --- a/apps/codex-plus-manager/src-tauri/tests/windows_subsystem.rs +++ b/apps/codex-plus-manager/src-tauri/tests/windows_subsystem.rs @@ -365,3 +365,14 @@ fn manager_update_install_keeps_visible_progress_bar() { assert!(app_tsx.contains("completedTitle={t(\"上次更新结果\")}")); assert!(app_tsx.contains("progress={updateInstallProgress}")); } + +#[test] +fn model_routing_provider_edits_keep_the_live_router_config() { + let manifest_dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")); + let app_tsx = manifest_dir.parent().unwrap().join("src/App.tsx"); + let app_tsx = std::fs::read_to_string(&app_tsx).expect("read manager App.tsx"); + + assert!(app_tsx.contains("if (!switchSettings.modelRoutingEnabled)")); + assert!(app_tsx.contains("if (form.modelRoutingEnabled)")); + assert!(app_tsx.contains("await actions.switchRelayProfile(next, form.activeRelayId)")); +} diff --git a/apps/codex-plus-manager/src/App.tsx b/apps/codex-plus-manager/src/App.tsx index 7030161b..79b6ec22 100644 --- a/apps/codex-plus-manager/src/App.tsx +++ b/apps/codex-plus-manager/src/App.tsx @@ -179,6 +179,7 @@ type BackendSettings = { providerSyncManualProviders: string[]; providerSyncLastSelectedProvider: string; relayProfilesEnabled: boolean; + modelRoutingEnabled: boolean; enhancementsEnabled: boolean; computerUseGuardEnabled: boolean; codexAppPluginMarketplaceUnlock: boolean; @@ -760,6 +761,7 @@ const defaultSettings: BackendSettings = { providerSyncManualProviders: [], providerSyncLastSelectedProvider: "", relayProfilesEnabled: true, + modelRoutingEnabled: false, enhancementsEnabled: true, computerUseGuardEnabled: false, codexAppPluginMarketplaceUnlock: true, @@ -2206,7 +2208,9 @@ export function App() { showNotice(t("供应商配置可能不正确"), validationError, "failed"); return; } - switchSettings = await snapshotActiveRelayFilesBeforeSwitch(switchSettings, previousActiveRelayId); + if (!switchSettings.modelRoutingEnabled) { + switchSettings = await snapshotActiveRelayFilesBeforeSwitch(switchSettings, previousActiveRelayId); + } const selectedAfterSave = activeRelayProfile(switchSettings); const command = relayProfileSwitchCommand(selectedAfterSave); @@ -3260,6 +3264,22 @@ function RelayScreen({ +