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", id: "swiftfox-low",
label: "swiftfox low", label: "swiftfox low",
description: "", description: "",
model: "swiftfox-low", model: "swiftfox",
effort: None, effort: Some(ReasoningEffort::Low),
}, },
ModelPreset { ModelPreset {
id: "swiftfox-medium", id: "swiftfox-medium",
label: "swiftfox medium", label: "swiftfox medium",
description: "", description: "",
model: "swiftfox-medium", model: "swiftfox",
effort: None, effort: None,
}, },
ModelPreset { ModelPreset {
id: "swiftfox-high", id: "swiftfox-high",
label: "swiftfox high", label: "swiftfox high",
description: "", description: "",
model: "swiftfox-high", model: "swiftfox",
effort: None, effort: Some(ReasoningEffort::High),
}, },
ModelPreset { ModelPreset {
id: "gpt-5-minimal", id: "gpt-5-minimal",

View File

@@ -34,7 +34,8 @@ use toml_edit::DocumentMut;
const OPENAI_DEFAULT_MODEL: &str = "gpt-5"; const OPENAI_DEFAULT_MODEL: &str = "gpt-5";
const OPENAI_DEFAULT_REVIEW_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 /// 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 /// 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( persist_model_selection(
codex_home.path(), codex_home.path(),
None, None,
"swiftfox-high", "swiftfox",
Some(ReasoningEffort::High), Some(ReasoningEffort::High),
) )
.await?; .await?;
@@ -1187,7 +1188,7 @@ exclude_slash_tmp = true
tokio::fs::read_to_string(codex_home.path().join(CONFIG_TOML_FILE)).await?; tokio::fs::read_to_string(codex_home.path().join(CONFIG_TOML_FILE)).await?;
let parsed: ConfigToml = toml::from_str(&serialized)?; 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)); assert_eq!(parsed.model_reasoning_effort, Some(ReasoningEffort::High));
Ok(()) Ok(())
@@ -1241,7 +1242,7 @@ model = "gpt-4.1"
persist_model_selection( persist_model_selection(
codex_home.path(), codex_home.path(),
Some("dev"), Some("dev"),
"swiftfox-medium", "swiftfox",
Some(ReasoningEffort::Medium), Some(ReasoningEffort::Medium),
) )
.await?; .await?;
@@ -1254,7 +1255,7 @@ model = "gpt-4.1"
.get("dev") .get("dev")
.expect("profile should be created"); .expect("profile should be created");
assert_eq!(profile.model.as_deref(), Some("swiftfox-medium")); assert_eq!(profile.model.as_deref(), Some("swiftfox"));
assert_eq!( assert_eq!(
profile.model_reasoning_effort, profile.model_reasoning_effort,
Some(ReasoningEffort::Medium) Some(ReasoningEffort::Medium)

View File

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