summaryrefslogtreecommitdiffstats
path: root/src/repl/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/repl/mod.rs')
-rw-r--r--src/repl/mod.rs30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/repl/mod.rs b/src/repl/mod.rs
index 0a601c7..1b96d3b 100644
--- a/src/repl/mod.rs
+++ b/src/repl/mod.rs
@@ -25,19 +25,28 @@ use std::{env, process};
const MENU_NAME: &str = "completion_menu";
lazy_static! {
- static ref REPL_COMMANDS: [ReplCommand; 14] = [
+ static ref REPL_COMMANDS: [ReplCommand; 15] = [
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(".role", "Use a role", State::able_change_role()),
- ReplCommand::new(".info role", "Show role info", State::in_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 session info", State::in_session(),),
+ ReplCommand::new(
+ ".info session",
+ "Show the session info",
+ State::in_session(),
+ ),
+ ReplCommand::new(
+ ".save session",
+ "Save the session to the file",
+ State::in_session(),
+ ),
ReplCommand::new(
".clear messages",
"Clear messages in the session",
@@ -160,7 +169,7 @@ impl Repl {
}
Some(_) => unknown_command()?,
None => {
- let output = self.config.read().sys_info()?;
+ let output = self.config.read().system_info()?;
println!("{}", output);
}
},
@@ -187,6 +196,19 @@ impl Repl {
".session" => {
self.config.write().start_session(args)?;
}
+ ".save" => {
+ match args.map(|v| match v.split_once(' ') {
+ Some((subcmd, args)) => (subcmd, args.trim()),
+ None => (v, ""),
+ }) {
+ Some(("session", name)) => {
+ self.config.write().save_session(name)?;
+ }
+ _ => {
+ println!(r#"Usage: .save session [name]"#)
+ }
+ }
+ }
".set" => {
if let Some(args) = args {
self.config.write().update(args)?;