Merge remote-tracking branch 'origin/main' into jif/fix-ui-update

This commit is contained in:
jimmyfraiture
2025-09-15 16:50:43 +01:00
3 changed files with 40 additions and 11 deletions

View File

@@ -39,7 +39,6 @@ use toml_edit::Table as TomlTable;
const OPENAI_DEFAULT_MODEL: &str = "gpt-5";
const OPENAI_DEFAULT_REVIEW_MODEL: &str = "gpt-5";
pub const GPT_5_CODEX_MEDIUM_MODEL: &str = "gpt-5-codex";
pub const GPT_5_CODEX_DISPLAY_NAME: &str = "gpt-5-codex";
/// 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

View File

@@ -3,7 +3,6 @@ use crate::frames::FRAME_TICK_DEFAULT;
use crate::tui::FrameRequester;
use crate::tui::Tui;
use crate::tui::TuiEvent;
use codex_core::config::GPT_5_CODEX_DISPLAY_NAME;
use color_eyre::eyre::Result;
use crossterm::event::KeyCode;
use crossterm::event::KeyEvent;
@@ -135,17 +134,16 @@ impl WidgetRef for &ModelUpgradePopup {
lines.push("".into());
}
lines.push(
format!(" Codex is now powered by {GPT_5_CODEX_DISPLAY_NAME}, a new model that is")
.into(),
);
lines.push(Line::from(vec![
" ".into(),
"faster, a better collaborator, ".bold(),
"and ".into(),
"more steerable.".bold(),
"Introducing GPT-5-Codex".bold(),
]));
lines.push("".into());
lines.push(
" GPT-5-Codex works faster through easy tasks and harder on complex tasks,".into(),
);
lines.push(" improves on code quality, and is more steerable with AGENTS.md.".into());
lines.push("".into());
let create_option =
|index: usize, option: ModelUpgradeOption, text: &str| -> Line<'static> {
@@ -162,13 +160,13 @@ impl WidgetRef for &ModelUpgradePopup {
lines.push(create_option(
0,
ModelUpgradeOption::TryNewModel,
&format!("Yes, switch me to {GPT_5_CODEX_DISPLAY_NAME}"),
"Try the new GPT-5-Codex model",
));
lines.push("".into());
lines.push(create_option(
1,
ModelUpgradeOption::KeepCurrent,
"Not right now",
"Continue using current model",
));
lines.push("".into());
lines.push(

View File

@@ -319,6 +319,8 @@ pub(crate) async fn run_onboarding_app(
use tokio_stream::StreamExt;
let mut onboarding_screen = OnboardingScreen::new(tui, args);
// One-time guard to fully clear the screen after ChatGPT login success message is shown
let mut did_full_clear_after_success = false;
tui.draw(u16::MAX, |frame| {
frame.render_widget_ref(&onboarding_screen, frame.area());
@@ -337,6 +339,36 @@ pub(crate) async fn run_onboarding_app(
onboarding_screen.handle_paste(text);
}
TuiEvent::Draw => {
if !did_full_clear_after_success
&& onboarding_screen.steps.iter().any(|step| {
if let Step::Auth(w) = step {
w.sign_in_state.read().is_ok_and(|g| {
matches!(&*g, super::auth::SignInState::ChatGptSuccessMessage)
})
} else {
false
}
})
{
// Reset any lingering SGR (underline/color) before clearing
let _ = ratatui::crossterm::execute!(
std::io::stdout(),
ratatui::crossterm::style::SetAttribute(
ratatui::crossterm::style::Attribute::Reset
),
ratatui::crossterm::style::SetAttribute(
ratatui::crossterm::style::Attribute::NoUnderline
),
ratatui::crossterm::style::SetForegroundColor(
ratatui::crossterm::style::Color::Reset
),
ratatui::crossterm::style::SetBackgroundColor(
ratatui::crossterm::style::Color::Reset
)
);
let _ = tui.terminal.clear();
did_full_clear_after_success = true;
}
let _ = tui.draw(u16::MAX, |frame| {
frame.render_widget_ref(&onboarding_screen, frame.area());
});