From a9ea86f3f8c9cba5e453b7a50894da682e022ba8 Mon Sep 17 00:00:00 2001 From: sigoden Date: Fri, 13 Sep 2024 09:08:43 +0800 Subject: feat: add `.delete` repl command (#862) --- src/repl/mod.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/repl') 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 ...") } }, + ".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()) -- cgit v1.2.3