summaryrefslogtreecommitdiffstats
path: root/src/repl
diff options
context:
space:
mode:
Diffstat (limited to 'src/repl')
-rw-r--r--src/repl/mod.rs26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/repl/mod.rs b/src/repl/mod.rs
index 6c15002..2111c48 100644
--- a/src/repl/mod.rs
+++ b/src/repl/mod.rs
@@ -33,7 +33,7 @@ lazy_static! {
const MENU_NAME: &str = "completion_menu";
lazy_static! {
- static ref REPL_COMMANDS: [ReplCommand; 26] = [
+ static ref REPL_COMMANDS: [ReplCommand; 27] = [
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()),
@@ -89,17 +89,22 @@ lazy_static! {
),
ReplCommand::new(
".rag",
- "Init or use a rag",
+ "Init or use the RAG",
AssertState::False(StateFlags::AGENT)
),
ReplCommand::new(
".info rag",
- "View rag info",
+ "View RAG info",
+ AssertState::True(StateFlags::RAG),
+ ),
+ ReplCommand::new(
+ ".rebuild rag",
+ "Rebuild the RAG to sync document changes",
AssertState::True(StateFlags::RAG),
),
ReplCommand::new(
".exit rag",
- "Leave the rag",
+ "Leave the RAG",
AssertState::TrueFalse(StateFlags::RAG, StateFlags::AGENT),
),
ReplCommand::new(".agent", "Use a agent", AssertState::bare()),
@@ -314,6 +319,19 @@ Tips: use <tab> to autocomplete conversation starter text.
}
}
}
+ ".rebuild" => {
+ match args.map(|v| match v.split_once(' ') {
+ Some((subcmd, args)) => (subcmd, Some(args.trim())),
+ None => (v, None),
+ }) {
+ Some(("rag", _)) => {
+ Config::rebuild_rag(&self.config, self.abort_signal.clone()).await?;
+ }
+ _ => {
+ println!(r#"Usage: .rebuild rag"#)
+ }
+ }
+ }
".file" => match args {
Some(args) => {
let (files, text) = split_files_text(args);