Skip to content

Commit 3a01650

Browse files
committed
missing constants.rs
1 parent ddbe29b commit 3a01650

5 files changed

Lines changed: 259 additions & 94 deletions

File tree

crates/chat-cli/src/cli/chat/cli/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ use crate::cli::chat::{
5151
ChatState,
5252
};
5353
use crate::cli::issue;
54-
use crate::constants::ui_text::EXTRA_HELP;
54+
use crate::constants::ui_text;
5555
use crate::os::Os;
5656

5757
/// q (Amazon Q Chat)
5858
#[derive(Debug, PartialEq, Parser)]
59-
#[command(color = clap::ColorChoice::Always, term_width = 0, after_long_help = EXTRA_HELP)]
59+
#[command(color = clap::ColorChoice::Always, term_width = 0, after_long_help = &ui_text::extra_help())]
6060
pub enum SlashCommand {
6161
/// Quit the application
6262
#[command(aliases = ["q", "exit"])]

crates/chat-cli/src/cli/chat/mod.rs

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,7 @@ mod prompt;
1414
mod prompt_parser;
1515
pub mod server_messenger;
1616
use crate::cli::chat::checkpoint::CHECKPOINT_MESSAGE_MAX_LENGTH;
17-
use crate::constants::ui_text::{
18-
LIMIT_REACHED_TEXT,
19-
POPULAR_SHORTCUTS,
20-
RESUME_TEXT,
21-
SMALL_SCREEN_POPULAR_SHORTCUTS,
22-
SMALL_SCREEN_WELCOME,
23-
WELCOME_TEXT,
24-
};
17+
use crate::constants::ui_text;
2518
#[cfg(unix)]
2619
mod skim_integration;
2720
mod token_counter;
@@ -172,7 +165,6 @@ use crate::cli::experiment::experiment_manager::{
172165
use crate::constants::{
173166
error_messages,
174167
tips,
175-
ui_text,
176168
};
177169
use crate::database::settings::Setting;
178170
use crate::os::Os;
@@ -446,9 +438,6 @@ impl ChatArgs {
446438
// Maximum number of times to show the changelog announcement per version
447439
const CHANGELOG_MAX_SHOW_COUNT: i64 = 2;
448440

449-
// Only show the model-related tip for now to make users aware of this feature.
450-
const ROTATING_TIPS: [&str; 20] = tips::ROTATING_TIPS;
451-
452441
const GREETING_BREAK_POINT: usize = 80;
453442

454443
const RESPONSE_TIMEOUT_CONTENT: &str = "Response timed out - message took too long to generate";
@@ -997,7 +986,7 @@ impl ChatSession {
997986
{
998987
execute!(
999988
self.stderr,
1000-
style::Print(format!("\n\n{LIMIT_REACHED_TEXT} {limits_text}")),
989+
style::Print(format!("\n\n{} {limits_text}", ui_text::limit_reached_text())),
1001990
StyledText::secondary_fg(),
1002991
style::Print("\n\nUse "),
1003992
StyledText::success_fg(),
@@ -1193,16 +1182,17 @@ impl ChatSession {
11931182
.unwrap_or(true)
11941183
{
11951184
let welcome_text = match self.existing_conversation {
1196-
true => RESUME_TEXT,
1185+
true => ui_text::resume_text(),
11971186
false => match is_small_screen {
1198-
true => SMALL_SCREEN_WELCOME,
1199-
false => WELCOME_TEXT,
1187+
true => ui_text::small_screen_welcome(),
1188+
false => ui_text::welcome_text(),
12001189
},
12011190
};
12021191

1203-
execute!(self.stderr, style::Print(welcome_text), style::Print("\n\n"),)?;
1192+
execute!(self.stderr, style::Print(&welcome_text), style::Print("\n\n"),)?;
12041193

1205-
let tip = ROTATING_TIPS[usize::try_from(rand::random::<u32>()).unwrap_or(0) % ROTATING_TIPS.len()];
1194+
let rotating_tips = tips::get_rotating_tips();
1195+
let tip = &rotating_tips[usize::try_from(rand::random::<u32>()).unwrap_or(0) % rotating_tips.len()];
12061196
if is_small_screen {
12071197
// If the screen is small, print the tip in a single line
12081198
execute!(
@@ -1224,9 +1214,9 @@ impl ChatSession {
12241214
execute!(
12251215
self.stderr,
12261216
style::Print("\n"),
1227-
style::Print(match is_small_screen {
1228-
true => SMALL_SCREEN_POPULAR_SHORTCUTS,
1229-
false => POPULAR_SHORTCUTS,
1217+
style::Print(&match is_small_screen {
1218+
true => ui_text::small_screen_popular_shortcuts(),
1219+
false => ui_text::popular_shortcuts(),
12301220
}),
12311221
style::Print("\n"),
12321222
style::Print(

0 commit comments

Comments
 (0)