mirror of
https://github.com/openai/codex.git
synced 2026-04-24 14:45:27 +00:00
function
This commit is contained in:
@@ -51,15 +51,15 @@ static PRESETS: Lazy<Vec<ModelPreset>> = Lazy::new(|| {
|
||||
supported_reasoning_efforts: &[
|
||||
ReasoningEffortPreset {
|
||||
effort: ReasoningEffort::Low,
|
||||
description: "Fastest responses with limited reasoning",
|
||||
description: "Works faster",
|
||||
},
|
||||
ReasoningEffortPreset {
|
||||
effort: ReasoningEffort::Medium,
|
||||
description: "Balanced responses that adapt to the task",
|
||||
description: "Balances speed with intelligence",
|
||||
},
|
||||
ReasoningEffortPreset {
|
||||
effort: ReasoningEffort::High,
|
||||
description: "Maximum reasoning depth for complex problems",
|
||||
description: "Works longer for harder tasks",
|
||||
},
|
||||
],
|
||||
is_default: true,
|
||||
|
||||
@@ -532,8 +532,7 @@ impl App {
|
||||
self.chat_widget.open_legacy_model_popup();
|
||||
}
|
||||
AppEvent::ApplyModelAndEffort { model, effort } => {
|
||||
self.chat_widget
|
||||
.apply_model_and_effort(model.clone(), effort);
|
||||
self.chat_widget.apply_model_and_effort(model, effort);
|
||||
}
|
||||
AppEvent::OpenFullAccessConfirmation { preset } => {
|
||||
self.chat_widget.open_full_access_confirmation(preset);
|
||||
|
||||
@@ -1985,11 +1985,15 @@ impl ChatWidget {
|
||||
return;
|
||||
}
|
||||
|
||||
let featured_model = featured.into_iter().next().expect("featured preset");
|
||||
let Some(featured_model) = featured.into_iter().next() else {
|
||||
unreachable!("featured presets checked to be non-empty");
|
||||
};
|
||||
let mut items = self.featured_model_items(&featured_model);
|
||||
items.push(SelectionItem {
|
||||
name: "Legacy models…".to_string(),
|
||||
description: Some("Browse GPT-5.1 Codex, GPT-5, and other legacy models.".to_string()),
|
||||
name: "All models".to_string(),
|
||||
description: Some(
|
||||
"Choose and configure what model and reasoning level to use".to_string(),
|
||||
),
|
||||
selected_description: None,
|
||||
is_current: false,
|
||||
actions: vec![Box::new(|tx| {
|
||||
@@ -2110,8 +2114,9 @@ impl ChatWidget {
|
||||
let label = effort_label_for_model(&model_slug, Some(effort))
|
||||
.map(str::to_string)
|
||||
.unwrap_or_else(|| Self::featured_option_label(effort));
|
||||
let mut name = format!("{} — {}", preset.display_name, label);
|
||||
if effort == default_effort {
|
||||
let is_current_option = current_effort == Some(effort);
|
||||
let mut name = label.to_string();
|
||||
if effort == default_effort && !is_current_option {
|
||||
name.push_str(" (default)");
|
||||
}
|
||||
|
||||
@@ -2121,7 +2126,7 @@ impl ChatWidget {
|
||||
name,
|
||||
description,
|
||||
selected_description: None,
|
||||
is_current: current_effort == Some(effort),
|
||||
is_current: is_current_option,
|
||||
actions,
|
||||
dismiss_on_select: true,
|
||||
..Default::default()
|
||||
@@ -2210,7 +2215,8 @@ impl ChatWidget {
|
||||
if let Some(first) = effort_label.get_mut(0..1) {
|
||||
first.make_ascii_uppercase();
|
||||
}
|
||||
if choice.stored == default_choice {
|
||||
let is_current_choice = is_current_model && choice.stored == highlight_choice;
|
||||
if choice.stored == default_choice && !is_current_choice {
|
||||
effort_label.push_str(" (default)");
|
||||
}
|
||||
|
||||
@@ -2263,7 +2269,7 @@ impl ChatWidget {
|
||||
name: effort_label,
|
||||
description,
|
||||
selected_description,
|
||||
is_current: is_current_model && choice.stored == highlight_choice,
|
||||
is_current: is_current_choice,
|
||||
actions,
|
||||
dismiss_on_select: true,
|
||||
..Default::default()
|
||||
|
||||
@@ -6,12 +6,10 @@ expression: popup
|
||||
Select Model
|
||||
Quickly pick Codex Auto or open the legacy list for more options.
|
||||
|
||||
› 1. codex-auto — Fast Fastest responses with limited reasoning
|
||||
2. codex-auto — Balanced (default) Balanced responses that adapt to the
|
||||
task
|
||||
3. codex-auto — Thorough Maximum reasoning depth for complex
|
||||
problems
|
||||
4. Legacy models… Browse GPT-5.1 Codex, GPT-5, and other
|
||||
legacy models.
|
||||
› 1. Fast Works faster
|
||||
2. Balanced (default) Balances speed with intelligence
|
||||
3. Thorough Works longer for harder tasks
|
||||
4. All models Choose and configure what model and reasoning level
|
||||
to use
|
||||
|
||||
Press enter to apply selection, or esc to dismiss.
|
||||
|
||||
@@ -1440,6 +1440,29 @@ fn model_selection_popup_snapshot() {
|
||||
assert_snapshot!("model_selection_popup", popup);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn featured_model_popup_hides_default_label_when_option_is_current() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual();
|
||||
|
||||
let preset = builtin_model_presets(None)
|
||||
.into_iter()
|
||||
.find(|preset| preset.is_default)
|
||||
.expect("default preset");
|
||||
chat.config.model = preset.model.to_string();
|
||||
chat.config.model_reasoning_effort = Some(preset.default_reasoning_effort);
|
||||
chat.open_model_popup();
|
||||
|
||||
let popup = render_bottom_popup(&chat, 80);
|
||||
let current_line = popup
|
||||
.lines()
|
||||
.find(|line| line.contains("(current)"))
|
||||
.expect("current featured option line");
|
||||
assert!(
|
||||
!current_line.contains("(default)"),
|
||||
"expected current featured option to omit redundant default tag: {current_line}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn approvals_selection_popup_snapshot() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual();
|
||||
@@ -1523,6 +1546,29 @@ fn model_reasoning_selection_popup_snapshot() {
|
||||
assert_snapshot!("model_reasoning_selection_popup", popup);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reasoning_popup_hides_default_label_when_option_is_current() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual();
|
||||
|
||||
let preset = builtin_model_presets(None)
|
||||
.into_iter()
|
||||
.find(|preset| preset.is_default)
|
||||
.expect("default preset");
|
||||
chat.config.model = preset.model.to_string();
|
||||
chat.config.model_reasoning_effort = Some(preset.default_reasoning_effort);
|
||||
chat.open_reasoning_popup(preset, None);
|
||||
|
||||
let popup = render_bottom_popup(&chat, 80);
|
||||
let current_line = popup
|
||||
.lines()
|
||||
.find(|line| line.contains("(current)"))
|
||||
.expect("current reasoning option line");
|
||||
assert!(
|
||||
!current_line.contains("(default)"),
|
||||
"expected current reasoning option to omit redundant default tag: {current_line}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn single_reasoning_option_skips_selection() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual();
|
||||
|
||||
Reference in New Issue
Block a user