Login flow polish (#3632)
# Description - Update sign in flow # Tests - Passes CI --------- Co-authored-by: Michael Bolin <mbolin@openai.com>
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
use crate::frames::ALL_VARIANTS as FRAME_VARIANTS;
|
||||
use crate::frames::FRAME_TICK_DEFAULT;
|
||||
use crate::tui::FrameRequester;
|
||||
use crate::tui::Tui;
|
||||
use crate::tui::TuiEvent;
|
||||
@@ -19,75 +21,7 @@ use ratatui::widgets::Wrap;
|
||||
use std::time::Duration;
|
||||
use tokio_stream::StreamExt;
|
||||
|
||||
// Embed animation frames for each variant at compile time.
|
||||
macro_rules! frames_for {
|
||||
($dir:literal) => {
|
||||
[
|
||||
include_str!(concat!("../frames/", $dir, "/frame_1.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_2.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_3.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_4.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_5.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_6.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_7.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_8.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_9.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_10.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_11.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_12.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_13.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_14.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_15.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_16.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_17.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_18.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_19.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_20.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_21.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_22.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_23.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_24.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_25.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_26.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_27.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_28.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_29.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_30.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_31.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_32.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_33.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_34.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_35.txt")),
|
||||
include_str!(concat!("../frames/", $dir, "/frame_36.txt")),
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
const FRAMES_DEFAULT: [&str; 36] = frames_for!("default");
|
||||
const FRAMES_CODEX: [&str; 36] = frames_for!("codex");
|
||||
const FRAMES_OPENAI: [&str; 36] = frames_for!("openai");
|
||||
const FRAMES_BLOCKS: [&str; 36] = frames_for!("blocks");
|
||||
const FRAMES_DOTS: [&str; 36] = frames_for!("dots");
|
||||
const FRAMES_HASH: [&str; 36] = frames_for!("hash");
|
||||
const FRAMES_HBARS: [&str; 36] = frames_for!("hbars");
|
||||
const FRAMES_VBARS: [&str; 36] = frames_for!("vbars");
|
||||
const FRAMES_SHAPES: [&str; 36] = frames_for!("shapes");
|
||||
const FRAMES_SLUG: [&str; 36] = frames_for!("slug");
|
||||
|
||||
const VARIANTS: &[&[&str]] = &[
|
||||
&FRAMES_DEFAULT,
|
||||
&FRAMES_CODEX,
|
||||
&FRAMES_OPENAI,
|
||||
&FRAMES_BLOCKS,
|
||||
&FRAMES_DOTS,
|
||||
&FRAMES_HASH,
|
||||
&FRAMES_HBARS,
|
||||
&FRAMES_VBARS,
|
||||
&FRAMES_SHAPES,
|
||||
&FRAMES_SLUG,
|
||||
];
|
||||
|
||||
const FRAME_TICK: Duration = Duration::from_millis(60);
|
||||
const FRAME_TICK: Duration = FRAME_TICK_DEFAULT;
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub(crate) enum ModelUpgradeDecision {
|
||||
@@ -156,11 +90,11 @@ impl ModelUpgradePopup {
|
||||
}
|
||||
|
||||
fn frames(&self) -> &'static [&'static str] {
|
||||
VARIANTS[self.variant_idx]
|
||||
FRAME_VARIANTS[self.variant_idx]
|
||||
}
|
||||
|
||||
fn pick_random_variant(&mut self) {
|
||||
let total = VARIANTS.len();
|
||||
let total = FRAME_VARIANTS.len();
|
||||
if total <= 1 {
|
||||
return;
|
||||
}
|
||||
@@ -196,13 +130,11 @@ impl WidgetRef for &ModelUpgradePopup {
|
||||
lines.push("".into());
|
||||
|
||||
lines.push(
|
||||
format!(
|
||||
" Codex is now powered by {SWIFTFOX_MODEL_DISPLAY_NAME}, a new model that is"
|
||||
)
|
||||
.into(),
|
||||
format!(" Codex is now powered by {SWIFTFOX_MODEL_DISPLAY_NAME}, a new model that is")
|
||||
.into(),
|
||||
);
|
||||
lines.push(Line::from(vec![
|
||||
" ".into(),
|
||||
" ".into(),
|
||||
"faster, a better collaborator, ".bold(),
|
||||
"and ".into(),
|
||||
"more steerable.".bold(),
|
||||
@@ -226,6 +158,7 @@ impl WidgetRef for &ModelUpgradePopup {
|
||||
ModelUpgradeOption::TryNewModel,
|
||||
&format!("Yes, switch me to {SWIFTFOX_MODEL_DISPLAY_NAME}"),
|
||||
));
|
||||
lines.push("".into());
|
||||
lines.push(create_option(
|
||||
1,
|
||||
ModelUpgradeOption::KeepCurrent,
|
||||
|
||||
Reference in New Issue
Block a user