summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-04-20 21:07:30 +0800
committerGitHub <noreply@github.com>2024-04-20 21:07:30 +0800
commit8ab57ed74ea67d3f023aa0fcd695cb107b676501 (patch)
tree3047e4efdc24f66b30a9df30058695b757e2c342 /src
parent5d763fc10c4e3d40268ead473ccb0000b4923bd1 (diff)
downloadaichat-8ab57ed74ea67d3f023aa0fcd695cb107b676501.tar.gz
refactor: update description for cli options and config fields (#423)
Diffstat (limited to 'src')
-rw-r--r--src/cli.rs24
-rw-r--r--src/config/mod.rs22
-rw-r--r--src/main.rs2
-rw-r--r--src/render/stream.rs2
-rw-r--r--src/repl/mod.rs48
5 files changed, 32 insertions, 66 deletions
diff --git a/src/cli.rs b/src/cli.rs
index 20192c8..d3e1075 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -3,43 +3,43 @@ use clap::Parser;
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
pub struct Cli {
- /// Choose a LLM model
+ /// Select a LLM model
#[clap(short, long)]
pub model: Option<String>,
- /// Choose a role
+ /// Select a role
#[clap(short, long)]
pub role: Option<String>,
- /// Create or reuse a session
+ /// Start or join a session
#[clap(short = 's', long)]
pub session: Option<Option<String>>,
- /// Whether to save the session
+ /// Forces the session to be saved
#[clap(long)]
pub save_session: bool,
- /// Execute commands using natural language
+ /// Execute commands in natural language
#[clap(short = 'e', long)]
pub execute: bool,
- /// Generate only code
+ /// Output code only
#[clap(short = 'c', long)]
pub code: bool,
- /// Attach files to the message
+ /// Include files with the message
#[clap(short = 'f', long, value_name = "FILE")]
pub file: Vec<String>,
- /// Disable syntax highlighting
+ /// Turn off syntax highlighting
#[clap(short = 'H', long)]
pub no_highlight: bool,
- /// No stream output
+ /// Turns off stream mode
#[clap(short = 'S', long)]
pub no_stream: bool,
- /// Specify the text-wrapping mode (no, auto, <max-width>)
+ /// Control text wrapping (no, auto, <max-width>)
#[clap(short = 'w', long)]
pub wrap: Option<String>,
/// Use light theme
#[clap(long)]
pub light_theme: bool,
- /// Run in dry run mode
+ /// Display the message without sending it
#[clap(long)]
pub dry_run: bool,
- /// Print related information
+ /// Dispaly information
#[clap(long)]
pub info: bool,
/// List all available models
diff --git a/src/config/mod.rs b/src/config/mod.rs
index 2a3a866..9b771ec 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -44,52 +44,30 @@ const CLIENTS_FIELD: &str = "clients";
#[derive(Debug, Clone, Deserialize)]
#[serde(default)]
pub struct Config {
- /// LLM model
#[serde(rename(serialize = "model", deserialize = "model"))]
pub model_id: Option<String>,
- /// LLM temperature
pub temperature: Option<f64>,
- /// Dry-run flag
pub dry_run: bool,
- /// Whether to save the message
pub save: bool,
- /// Whether to save the session
pub save_session: Option<bool>,
- /// Whether to disable highlight
pub highlight: bool,
- /// Whether to use a light theme
pub light_theme: bool,
- /// Specify the text-wrapping mode (no, auto, <max-width>)
pub wrap: Option<String>,
- /// Whether wrap code block
pub wrap_code: bool,
- /// Automatically copy the last output to the clipboard
pub auto_copy: bool,
- /// REPL keybindings. (emacs, vi)
pub keybindings: Keybindings,
- /// Set a default role or session (role:<name>, session:<name>)
pub prelude: Option<String>,
- /// Command that will be used to edit the current line buffer
pub buffer_editor: Option<String>,
- /// Compress session if tokens exceed this value (>=1000)
pub compress_threshold: usize,
- /// The prompt for summarizing session messages
pub summarize_prompt: String,
- // The prompt for the summary of the session
pub summary_prompt: String,
- /// REPL left prompt
pub left_prompt: String,
- /// REPL right prompt
pub right_prompt: String,
- /// Setup clients
pub clients: Vec<ClientConfig>,
- /// Predefined roles
#[serde(skip)]
pub roles: Vec<Role>,
- /// Current selected role
#[serde(skip)]
pub role: Option<Role>,
- /// Current session
#[serde(skip)]
pub session: Option<Session>,
#[serde(skip)]
diff --git a/src/main.rs b/src/main.rs
index 4ab4cb8..66492da 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -169,7 +169,7 @@ fn execute(config: &GlobalConfig, mut input: Input) -> Result<()> {
println!("{}", markdown_render.render(&eval_str).trim());
let mut explain = false;
loop {
- let answer = Text::new("[1]:execute [2]:explain [3]:revise [4]:exit")
+ let answer = Text::new("[1]:execute [2]:explain [3]:revise [4]:cancel")
.with_default("1")
.with_validator(|input: &str| match matches!(input, "1" | "2" | "3" | "4") {
true => Ok(Validation::Valid),
diff --git a/src/render/stream.rs b/src/render/stream.rs
index 2bebf8c..8bb4a0e 100644
--- a/src/render/stream.rs
+++ b/src/render/stream.rs
@@ -66,7 +66,7 @@ fn markdown_stream_inner(
let columns = terminal::size()?.0;
- let mut spinner = Spinner::new(" Thinking");
+ let mut spinner = Spinner::new(" Generating");
'outer: loop {
if abort.aborted() {
diff --git a/src/repl/mod.rs b/src/repl/mod.rs
index 564bdf9..73196bc 100644
--- a/src/repl/mod.rs
+++ b/src/repl/mod.rs
@@ -26,35 +26,31 @@ const MENU_NAME: &str = "completion_menu";
lazy_static! {
static ref REPL_COMMANDS: [ReplCommand; 16] = [
- ReplCommand::new(".help", "Print this help message", State::all()),
- ReplCommand::new(".info", "Print system info", State::all()),
- ReplCommand::new(".model", "Switch LLM model", State::all()),
+ ReplCommand::new(".help", "Show this help message", State::all()),
+ ReplCommand::new(".info", "View system info", State::all()),
+ ReplCommand::new(".model", "Change the current LLM", State::all()),
ReplCommand::new(
".prompt",
- "Use a temp role with this prompt",
+ "Make a temporary role using a prompt",
State::able_change_role()
),
- ReplCommand::new(".role", "Use a role", State::able_change_role()),
- ReplCommand::new(".info role", "Show the role info", State::in_role(),),
- ReplCommand::new(".exit role", "Leave current role", State::in_role(),),
ReplCommand::new(
- ".session",
- "Start a context-aware chat session",
- State::not_in_session(),
- ),
- ReplCommand::new(
- ".info session",
- "Show the session info",
- State::in_session(),
+ ".role",
+ "Switch to a specific role",
+ State::able_change_role()
),
+ ReplCommand::new(".info role", "View role info", State::in_role(),),
+ ReplCommand::new(".exit role", "Leave the role", State::in_role(),),
+ ReplCommand::new(".session", "Begin a chat session", State::not_in_session(),),
+ ReplCommand::new(".info session", "View session info", State::in_session(),),
ReplCommand::new(
".save session",
- "Save the session to the file",
+ "Save the chat to file",
State::in_session(),
),
ReplCommand::new(
".clear messages",
- "Clear messages in the session",
+ "Erase messages in the current session",
State::unable_change_role()
),
ReplCommand::new(
@@ -62,17 +58,9 @@ lazy_static! {
"End the current session",
State::in_session(),
),
- ReplCommand::new(
- ".file",
- "Attach files to the message and then submit it",
- State::all()
- ),
- ReplCommand::new(".set", "Modify the configuration parameters", State::all()),
- ReplCommand::new(
- ".copy",
- "Copy the last reply to the clipboard",
- State::all()
- ),
+ ReplCommand::new(".file", "Include files with the message", State::all()),
+ ReplCommand::new(".set", "Adjust settings", State::all()),
+ ReplCommand::new(".copy", "Copy the last response", State::all()),
ReplCommand::new(".exit", "Exit the REPL", State::all()),
];
static ref COMMAND_RE: Regex = Regex::new(r"^\s*(\.\S*)\s*").unwrap();
@@ -420,9 +408,9 @@ fn dump_repl_help() {
println!(
r###"{head}
-Type ::: to begin multi-line editing, type ::: to end it.
+Type ::: to start multi-line editing, type ::: to finish it.
Press Ctrl+O to open an editor to edit line input.
-Press Ctrl+C to cancel reply, Ctrl+D to exit REPL"###,
+Press Ctrl+C to cancel the response, Ctrl+D to exit the REPL"###,
);
}