summaryrefslogtreecommitdiffstats
path: root/src/repl/mod.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-09-13 09:08:43 +0800
committerGitHub <noreply@github.com>2024-09-13 09:08:43 +0800
commita9ea86f3f8c9cba5e453b7a50894da682e022ba8 (patch)
treed016df1187778c7602cc6e8897fae1620d69b34f /src/repl/mod.rs
parent99005a2032bdd306b7bf89fe86117eab15b4cfe7 (diff)
downloadaichat-a9ea86f3f8c9cba5e453b7a50894da682e022ba8.tar.gz
feat: add `.delete` repl command (#862)
Diffstat (limited to 'src/repl/mod.rs')
-rw-r--r--src/repl/mod.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/repl/mod.rs b/src/repl/mod.rs
index 8c68f78..13e147b 100644
--- a/src/repl/mod.rs
+++ b/src/repl/mod.rs
@@ -31,7 +31,7 @@ lazy_static::lazy_static! {
const MENU_NAME: &str = "completion_menu";
lazy_static::lazy_static! {
- static ref REPL_COMMANDS: [ReplCommand; 30] = [
+ static ref REPL_COMMANDS: [ReplCommand; 31] = [
ReplCommand::new(".help", "Show this help message", AssertState::pass()),
ReplCommand::new(".info", "View system info", AssertState::pass()),
ReplCommand::new(".model", "Change the current LLM", AssertState::pass()),
@@ -148,6 +148,7 @@ lazy_static::lazy_static! {
AssertState::pass()
),
ReplCommand::new(".set", "Adjust settings", AssertState::pass()),
+ ReplCommand::new(".delete", "Delete roles/sessions/RAGs/agents-config", AssertState::pass()),
ReplCommand::new(".copy", "Copy the last response", AssertState::pass()),
ReplCommand::new(".exit", "Exit the REPL", AssertState::pass()),
];
@@ -392,6 +393,14 @@ impl Repl {
println!("Usage: .set <key> <value>...")
}
},
+ ".delete" => match args {
+ Some(args) => {
+ Config::delete(&self.config, args)?;
+ }
+ _ => {
+ println!("Usage: .delete [roles|sessions|rags|agents-config]")
+ }
+ },
".copy" => {
let config = self.config.read();
self.copy(config.last_reply())