Fix swiftfox model selector (#3598)

The model shouldn't be saved with a suffix. The effort is a separate
field.
This commit is contained in:
pakrym-oai
2025-09-14 16:12:21 -07:00
committed by GitHub
parent 916fdc2a37
commit 51f88fd04a
3 changed files with 17 additions and 14 deletions

View File

@@ -25,22 +25,22 @@ pub fn builtin_model_presets() -> &'static [ModelPreset] {
id: "swiftfox-low",
label: "swiftfox low",
description: "",
model: "swiftfox-low",
effort: None,
model: "swiftfox",
effort: Some(ReasoningEffort::Low),
},
ModelPreset {
id: "swiftfox-medium",
label: "swiftfox medium",
description: "",
model: "swiftfox-medium",
model: "swiftfox",
effort: None,
},
ModelPreset {
id: "swiftfox-high",
label: "swiftfox high",
description: "",
model: "swiftfox-high",
effort: None,
model: "swiftfox",
effort: Some(ReasoningEffort::High),
},
ModelPreset {
id: "gpt-5-minimal",

View File

@@ -34,7 +34,8 @@ use toml_edit::DocumentMut;
const OPENAI_DEFAULT_MODEL: &str = "gpt-5";
const OPENAI_DEFAULT_REVIEW_MODEL: &str = "gpt-5";
pub const SWIFTFOX_MEDIUM_MODEL: &str = "swiftfox-medium";
pub const SWIFTFOX_MEDIUM_MODEL: &str = "swiftfox";
pub const SWIFTFOX_MODEL_DISPLAY_NAME: &str = "swiftfox-medium";
/// Maximum number of bytes of the documentation that will be embedded. Larger
/// files are *silently truncated* to this size so we do not take up too much of
@@ -1178,7 +1179,7 @@ exclude_slash_tmp = true
persist_model_selection(
codex_home.path(),
None,
"swiftfox-high",
"swiftfox",
Some(ReasoningEffort::High),
)
.await?;
@@ -1187,7 +1188,7 @@ exclude_slash_tmp = true
tokio::fs::read_to_string(codex_home.path().join(CONFIG_TOML_FILE)).await?;
let parsed: ConfigToml = toml::from_str(&serialized)?;
assert_eq!(parsed.model.as_deref(), Some("swiftfox-high"));
assert_eq!(parsed.model.as_deref(), Some("swiftfox"));
assert_eq!(parsed.model_reasoning_effort, Some(ReasoningEffort::High));
Ok(())
@@ -1241,7 +1242,7 @@ model = "gpt-4.1"
persist_model_selection(
codex_home.path(),
Some("dev"),
"swiftfox-medium",
"swiftfox",
Some(ReasoningEffort::Medium),
)
.await?;
@@ -1254,7 +1255,7 @@ model = "gpt-4.1"
.get("dev")
.expect("profile should be created");
assert_eq!(profile.model.as_deref(), Some("swiftfox-medium"));
assert_eq!(profile.model.as_deref(), Some("swiftfox"));
assert_eq!(
profile.model_reasoning_effort,
Some(ReasoningEffort::Medium)

View File

@@ -1,7 +1,7 @@
use crate::tui::FrameRequester;
use crate::tui::Tui;
use crate::tui::TuiEvent;
use codex_core::config::SWIFTFOX_MEDIUM_MODEL;
use codex_core::config::SWIFTFOX_MODEL_DISPLAY_NAME;
use color_eyre::eyre::Result;
use crossterm::event::KeyCode;
use crossterm::event::KeyEvent;
@@ -83,8 +83,10 @@ impl WidgetRef for &ModelUpgradePopup {
let mut lines: Vec<Line> = vec![
String::new().into(),
format!(" Codex is now powered by {SWIFTFOX_MEDIUM_MODEL}, a new model that is")
.into(),
format!(
" Codex is now powered by {SWIFTFOX_MODEL_DISPLAY_NAME}, a new model that is"
)
.into(),
Line::from(vec![
" ".into(),
"faster, a better collaborator, ".bold(),
@@ -109,7 +111,7 @@ impl WidgetRef for &ModelUpgradePopup {
lines.push(create_option(
0,
ModelUpgradeOption::TryNewModel,
&format!("Yes, switch me to {SWIFTFOX_MEDIUM_MODEL}"),
&format!("Yes, switch me to {SWIFTFOX_MODEL_DISPLAY_NAME}"),
));
lines.push(create_option(
1,