From 6b77890ec400090caa5d9fa3bffee0db91c9adfc Mon Sep 17 00:00:00 2001 From: sigoden Date: Sun, 3 Nov 2024 08:07:46 +0800 Subject: feat: support `.edit rag-docs` (#964) --- src/repl/mod.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/repl/mod.rs') diff --git a/src/repl/mod.rs b/src/repl/mod.rs index c08afc3..7bf70ea 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; 34] = [ + static ref REPL_COMMANDS: [ReplCommand; 35] = [ 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()), @@ -105,6 +105,11 @@ lazy_static::lazy_static! { "Init or use the RAG", AssertState::False(StateFlags::AGENT) ), + ReplCommand::new( + ".edit rag-docs", + "Edit the RAG documents", + AssertState::True(StateFlags::RAG), + ), ReplCommand::new( ".rebuild rag", "Rebuild the RAG to sync document changes", @@ -360,8 +365,11 @@ impl Repl { Some(("session", _)) => { self.config.write().edit_session()?; } + Some(("rag-docs", _)) => { + Config::edit_rag_docs(&self.config, self.abort_signal.clone()).await?; + } _ => { - println!(r#"Usage: .edit "#) + println!(r#"Usage: .edit "#) } } } -- cgit v1.2.3