Fix NUX UI (#3534)

Fix NUX UI
This commit is contained in:
jif-oai
2025-09-12 14:09:31 -07:00
committed by GitHub
parent b8ccfe9b65
commit 8408f3e8ed
4 changed files with 32 additions and 24 deletions

View File

@@ -327,13 +327,15 @@ impl App {
fn show_model_save_hint(&mut self) { fn show_model_save_hint(&mut self) {
let model = self.config.model.clone(); let model = self.config.model.clone();
if self.active_profile.is_some() { if self.active_profile.is_some() {
self.chat_widget.add_info_message(format!( self.chat_widget.add_info_message(
"Model switched to {model}. Press Ctrl+S to save it for this profile, then press Ctrl+S again to set it as your global default." format!("Model changed to {model} for the current session"),
)); Some("(ctrl+s to set as profile default)".to_string()),
);
} else { } else {
self.chat_widget.add_info_message(format!( self.chat_widget.add_info_message(
"Model switched to {model}. Press Ctrl+S to save it as your global default." format!("Model changed to {model} for the current session"),
)); Some("(ctrl+s to set as default)".to_string()),
);
} }
} }
@@ -372,9 +374,6 @@ impl App {
let model = self.config.model.clone(); let model = self.config.model.clone();
let effort = self.config.model_reasoning_effort; let effort = self.config.model_reasoning_effort;
let effort_label = effort
.map(|effort| effort.to_string())
.unwrap_or_else(|| "none".to_string());
let codex_home = self.config.codex_home.clone(); let codex_home = self.config.codex_home.clone();
match scope { match scope {
@@ -382,9 +381,10 @@ impl App {
match persist_model_selection(&codex_home, Some(profile), &model, effort).await { match persist_model_selection(&codex_home, Some(profile), &model, effort).await {
Ok(()) => { Ok(()) => {
self.model_saved_to_profile = true; self.model_saved_to_profile = true;
self.chat_widget.add_info_message(format!( self.chat_widget.add_info_message(
"Saved model {model} ({effort_label}) for profile `{profile}`. Press Ctrl+S again to make this your global default." format!("Profile model changed to {model} for all sessions"),
)); Some("(view global config in config.toml)".to_string()),
);
} }
Err(err) => { Err(err) => {
tracing::error!( tracing::error!(
@@ -401,9 +401,10 @@ impl App {
match persist_model_selection(&codex_home, None, &model, effort).await { match persist_model_selection(&codex_home, None, &model, effort).await {
Ok(()) => { Ok(()) => {
self.model_saved_to_global = true; self.model_saved_to_global = true;
self.chat_widget.add_info_message(format!( self.chat_widget.add_info_message(
"Saved model {model} ({effort_label}) as your global default." format!("Default model changed to {model} for all sessions"),
)); Some("(view global config in config.toml)".to_string()),
)
} }
Err(err) => { Err(err) => {
tracing::error!( tracing::error!(
@@ -420,6 +421,7 @@ impl App {
self.chat_widget.add_info_message( self.chat_widget.add_info_message(
"Model preference already saved globally; no further action needed." "Model preference already saved globally; no further action needed."
.to_string(), .to_string(),
None,
); );
} }
} }

View File

@@ -1279,8 +1279,8 @@ impl ChatWidget {
self.config.model = model; self.config.model = model;
} }
pub(crate) fn add_info_message(&mut self, message: String) { pub(crate) fn add_info_message(&mut self, message: String, hint: Option<String>) {
self.add_to_history(history_cell::new_info_event(message)); self.add_to_history(history_cell::new_info_event(message, hint));
self.request_redraw(); self.request_redraw();
} }

View File

@@ -1053,9 +1053,13 @@ pub(crate) fn new_mcp_tools_output(
PlainHistoryCell { lines } PlainHistoryCell { lines }
} }
pub(crate) fn new_info_event(message: String) -> PlainHistoryCell { pub(crate) fn new_info_event(message: String, hint: Option<String>) -> PlainHistoryCell {
let lines: Vec<Line<'static>> = let mut line = vec!["> ".into(), message.into()];
vec![vec![padded_emoji("💾").green(), " ".into(), message.into()].into()]; if let Some(hint) = hint {
line.push(" ".into());
line.push(hint.dark_gray());
}
let lines: Vec<Line<'static>> = vec![line.into()];
PlainHistoryCell { lines } PlainHistoryCell { lines }
} }

View File

@@ -82,12 +82,14 @@ impl WidgetRef for &ModelUpgradePopup {
Clear.render(area, buf); Clear.render(area, buf);
let mut lines: Vec<Line> = vec![ let mut lines: Vec<Line> = vec![
String::new().into(),
format!(" Codex is now powered by {GPT5_HIGH_MODEL}, a new model that is").into(),
Line::from(vec![ Line::from(vec![
"> ".into(), " ".into(),
format!("Try {GPT5_HIGH_MODEL} as your default model").bold(), "faster, a better collaborator, ".bold(),
"and ".into(),
"more steerable.".bold(),
]), ]),
format!(" {GPT5_HIGH_MODEL} is our latest model tuned for coding workflows.").into(),
" Switch now or keep your current default you can change models any time.".into(),
"".into(), "".into(),
]; ];