summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/completions/aichat.bash6
-rw-r--r--scripts/completions/aichat.fish4
-rw-r--r--scripts/completions/aichat.nu6
-rw-r--r--scripts/completions/aichat.ps116
-rw-r--r--scripts/completions/aichat.zsh31
-rw-r--r--src/cli.rs4
-rw-r--r--src/config/mod.rs24
-rw-r--r--src/repl/mod.rs14
8 files changed, 54 insertions, 51 deletions
diff --git a/scripts/completions/aichat.bash b/scripts/completions/aichat.bash
index 856c6ba..afc81f5 100644
--- a/scripts/completions/aichat.bash
+++ b/scripts/completions/aichat.bash
@@ -19,7 +19,7 @@ _aichat() {
case "${cmd}" in
aichat)
- opts="-m -r -s -b -e -c -f -H -S -w -h -V --model --prompt --role --session --save-session --agent --rag --serve --execute --code --file --no-highlight --no-stream --wrap --light-theme --dry-run --info --list-models --list-roles --list-sessions --list-agents --list-rags --help --version"
+ opts="-m -r -s -a -R -e -c -f -H -S -w -h -V --model --prompt --role --session --save-session --agent --rag --serve --execute --code --file --no-highlight --no-stream --wrap --light-theme --dry-run --info --list-models --list-roles --list-sessions --list-agents --list-rags --help --version"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -61,11 +61,11 @@ _aichat() {
COMPREPLY=($(compgen -W "$("$1" --list-sessions)" -- "${cur}"))
return 0
;;
- -b|--agent)
+ -a|--agent)
COMPREPLY=($(compgen -W "$("$1" --list-agents)" -- "${cur}"))
return 0
;;
- --rag)
+ -R|--rag)
COMPREPLY=($(compgen -W "$("$1" --list-rags)" -- "${cur}"))
return 0
;;
diff --git a/scripts/completions/aichat.fish b/scripts/completions/aichat.fish
index d57f29d..4a926c9 100644
--- a/scripts/completions/aichat.fish
+++ b/scripts/completions/aichat.fish
@@ -3,8 +3,8 @@ complete -c aichat -l prompt -d 'Use the system prompt'
complete -c aichat -s r -l role -x -a "(aichat --list-roles)" -d 'Select a role' -r
complete -c aichat -s s -l session -x -a"(aichat --list-sessions)" -d 'Start or join a session' -r
complete -c aichat -l save-session -d 'Forces the session to be saved'
-complete -c aichat -s b -l agent -x -a"(aichat --list-agents)" -d 'Start a agent' -r
-complete -c aichat -l rag -x -a"(aichat --list-rags)" -d 'Start a RAG' -r
+complete -c aichat -s a -l agent -x -a"(aichat --list-agents)" -d 'Start a agent' -r
+complete -c aichat -s R -l rag -x -a"(aichat --list-rags)" -d 'Start a RAG' -r
complete -c aichat -s f -l file -d 'Include files with the message' -r -F
complete -c aichat -s w -l wrap -d 'Control text wrapping (no, auto, <max-width>)'
complete -c aichat -l serve -d 'Serve the LLM API and WebAPP'
diff --git a/scripts/completions/aichat.nu b/scripts/completions/aichat.nu
index 60f45f9..4a3d189 100644
--- a/scripts/completions/aichat.nu
+++ b/scripts/completions/aichat.nu
@@ -41,8 +41,8 @@ module completions {
--role(-r): string@"nu-complete aichat role" # Select a role
--session(-s): string@"nu-complete aichat role" # Start or join a session
--save-session # Forces the session to be saved
- --agent(-b): string@"nu-complete aichat agent" # Start a agent
- --rag: string@"nu-complete aichat rag" # Start a RAG
+ --agent(-a): string@"nu-complete aichat agent" # Start a agent
+ --rag(-R): string@"nu-complete aichat rag" # Start a RAG
--serve # Serve the LLM API and WebAPP
--execute(-e) # Execute commands in natural language
--code(-c) # Output code only
@@ -56,7 +56,7 @@ module completions {
--list-models # List all available chat models
--list-roles # List all roles
--list-sessions # List all sessions
- --list-agents # List all agents
+ --list-agents # List all agents
--list-rags # List all RAGs
...text: string # Input text
--help(-h) # Print help
diff --git a/scripts/completions/aichat.ps1 b/scripts/completions/aichat.ps1
index ac582d7..dd0dc9c 100644
--- a/scripts/completions/aichat.ps1
+++ b/scripts/completions/aichat.ps1
@@ -28,8 +28,9 @@ Register-ArgumentCompleter -Native -CommandName 'aichat' -ScriptBlock {
[CompletionResult]::new('-s', '-s', [CompletionResultType]::ParameterName, 'Start or join a session')
[CompletionResult]::new('--session', '--session', [CompletionResultType]::ParameterName, 'Start or join a session')
[CompletionResult]::new('--save-session', '--save-session', [CompletionResultType]::ParameterName, 'Forces the session to be saved')
- [CompletionResult]::new('-b', '-b', [CompletionResultType]::ParameterName, 'Start a agent')
+ [CompletionResult]::new('-a', '-a', [CompletionResultType]::ParameterName, 'Start a agent')
[CompletionResult]::new('--agent', '--agent', [CompletionResultType]::ParameterName, 'Start a agent')
+ [CompletionResult]::new('-R', '-R', [CompletionResultType]::ParameterName, 'Start a RAG')
[CompletionResult]::new('--rag', '--rag', [CompletionResultType]::ParameterName, 'Start a RAG')
[CompletionResult]::new('-f', '-f', [CompletionResultType]::ParameterName, 'Include files with the message')
[CompletionResult]::new('--file', '--file', [CompletionResultType]::ParameterName, 'Include files with the message')
@@ -70,17 +71,18 @@ Register-ArgumentCompleter -Native -CommandName 'aichat' -ScriptBlock {
$offset=1
}
$flag = $commandElements[$commandElements.Count-$offset].ToString()
- if ($flag -eq "-m" -or $flag -eq "--model") {
+ dump-args $flag ($flag -eq "-R") > /tmp/file1
+ if ($flag -ceq "-m" -or $flag -eq "--model") {
$completions = Get-AichatValues "--list-models"
- } elseif ($flag -eq "-r" -or $flag -eq "--role") {
+ } elseif ($flag -ceq "-r" -or $flag -eq "--role") {
$completions = Get-AichatValues "--list-roles"
- } elseif ($flag -eq "-s" -or $flag -eq "--session") {
+ } elseif ($flag -ceq "-s" -or $flag -eq "--session") {
$completions = Get-AichatValues "--list-sessions"
- } elseif ($flag -eq "-b" -or $flag -eq "--agent") {
+ } elseif ($flag -ceq "-a" -or $flag -eq "--agent") {
$completions = Get-AichatValues "--list-agents"
- } elseif ($flag -eq "--rag") {
+ } elseif ($flag -ceq "-R" -or $flag -eq "--rag") {
$completions = Get-AichatValues "--list-rags"
- } elseif ($flag -eq "-f" -or $flag -eq "--file") {
+ } elseif ($flag -ceq "-f" -or $flag -eq "--file") {
$completions = @()
}
}
diff --git a/scripts/completions/aichat.zsh b/scripts/completions/aichat.zsh
index 6d8dbc1..45da3ca 100644
--- a/scripts/completions/aichat.zsh
+++ b/scripts/completions/aichat.zsh
@@ -14,22 +14,23 @@ _aichat() {
fi
local context curcontext="$curcontext" state line
- local common=(
-'-m+[Select a LLM model]:MODEL:->models' \
-'--prompt=[Use the system prompt]:PROMPT: ' \
-'--model=[Select a LLM model]:MODEL:->models' \
-'-r+[Select a role]:ROLE:->roles' \
-'--role=[Select a role]:ROLE:->roles' \
-'-s+[Start or join a session]:SESSION:->sessions' \
-'--session=[Start or join a session]:SESSION:->sessions' \
+ local common=(
+'-m[Select a LLM model]:MODEL:->models' \
+'--model[Select a LLM model]:MODEL:->models' \
+'--prompt[Use the system prompt]:PROMPT: ' \
+'-r[Select a role]:ROLE:->roles' \
+'--role[Select a role]:ROLE:->roles' \
+'-s[Start or join a session]:SESSION:->sessions' \
+'--session[Start or join a session]:SESSION:->sessions' \
'--save-session[Forces the session to be saved]' \
-'-b+[Start a agent]:BOT:->agents' \
-'--agent=[Start a agent]:BOT:->agents' \
-'--rag=[Start a RAG]:RAG:->rags' \
-'*-f+[Include files with the message]:FILE:_files' \
-'*--file=[Include files with the message]:FILE:_files' \
-'-w+[Control text wrapping (no, auto, <max-width>)]:WRAP: ' \
-'--wrap=[Control text wrapping (no, auto, <max-width>)]:WRAP: ' \
+'-a[Start a agent]:AGENT:->agents' \
+'--agent[Start a agent]:AGENT:->agents' \
+'-R[Start a RAG]:RAG:->rags' \
+'--rag[Start a RAG]:RAG:->rags' \
+'*-f[Include files with the message]:FILE:_files' \
+'*--file[Include files with the message]:FILE:_files' \
+'-w[Control text wrapping (no, auto, <max-width>)]:WRAP: ' \
+'--wrap[Control text wrapping (no, auto, <max-width>)]:WRAP: ' \
'--serve[Serve the LLM API and WebAPP]' \
'-e[Execute commands in natural language]' \
'--execute[Execute commands in natural language]' \
diff --git a/src/cli.rs b/src/cli.rs
index 3e52af9..243fc82 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -19,10 +19,10 @@ pub struct Cli {
#[clap(long)]
pub save_session: bool,
/// Start a agent
- #[clap(short = 'b', long)]
+ #[clap(short = 'a', long)]
pub agent: Option<String>,
/// Start a RAG
- #[clap(long)]
+ #[clap(short = 'R', long)]
pub rag: Option<String>,
/// Serve the LLM API and WebAPP
#[clap(long, value_name = "ADDRESS")]
diff --git a/src/config/mod.rs b/src/config/mod.rs
index 0c1c6ac..8b0f995 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -46,10 +46,10 @@ const RAGS_DIR_NAME: &str = "rags";
const FUNCTIONS_DIR_NAME: &str = "functions";
const FUNCTIONS_FILE_NAME: &str = "functions.json";
const FUNCTIONS_BIN_DIR_NAME: &str = "bin";
-const BOTS_DIR_NAME: &str = "agents";
-const BOT_DEFINITION_FILE_NAME: &str = "index.yaml";
-const BOT_EMBEDDINGS_DIR: &str = "embeddings";
-const BOT_RAG_FILE_NAME: &str = "rag.bin";
+const AGENTS_DIR_NAME: &str = "agents";
+const AGENT_DEFINITION_FILE_NAME: &str = "index.yaml";
+const AGENT_EMBEDDINGS_DIR: &str = "embeddings";
+const AGENT_RAG_FILE_NAME: &str = "rag.bin";
pub const TEMP_ROLE_NAME: &str = "%%";
pub const TEMP_RAG_NAME: &str = "temp";
@@ -316,7 +316,7 @@ impl Config {
Self::rags_dir()?.join(format!("{name}.bin"))
} else {
Self::rags_dir()?
- .join(BOTS_DIR_NAME)
+ .join(AGENTS_DIR_NAME)
.join(format!("{name}.bin"))
};
Ok(path)
@@ -325,7 +325,7 @@ impl Config {
pub fn agents_config_dir() -> Result<PathBuf> {
match env::var(get_env_name("agents_config_dir")) {
Ok(value) => Ok(PathBuf::from(value)),
- Err(_) => Self::local_path(BOTS_DIR_NAME),
+ Err(_) => Self::local_path(AGENTS_DIR_NAME),
}
}
@@ -334,13 +334,13 @@ impl Config {
}
pub fn agent_rag_file(name: &str) -> Result<PathBuf> {
- Ok(Self::agent_config_dir(name)?.join(BOT_RAG_FILE_NAME))
+ Ok(Self::agent_config_dir(name)?.join(AGENT_RAG_FILE_NAME))
}
pub fn agents_functions_dir() -> Result<PathBuf> {
match env::var(get_env_name("agents_functions_dir")) {
Ok(value) => Ok(PathBuf::from(value)),
- Err(_) => Ok(Self::functions_dir()?.join(BOTS_DIR_NAME)),
+ Err(_) => Ok(Self::functions_dir()?.join(AGENTS_DIR_NAME)),
}
}
@@ -353,11 +353,11 @@ impl Config {
}
pub fn agent_definition_file(name: &str) -> Result<PathBuf> {
- Ok(Self::agent_functions_dir(name)?.join(BOT_DEFINITION_FILE_NAME))
+ Ok(Self::agent_functions_dir(name)?.join(AGENT_DEFINITION_FILE_NAME))
}
pub fn agent_embeddings_dir(name: &str) -> Result<PathBuf> {
- Ok(Self::agent_functions_dir(name)?.join(BOT_EMBEDDINGS_DIR))
+ Ok(Self::agent_functions_dir(name)?.join(AGENT_EMBEDDINGS_DIR))
}
pub fn state(&self) -> StateFlags {
@@ -370,7 +370,7 @@ impl Config {
}
}
if self.agent.is_some() {
- flags |= StateFlags::BOT;
+ flags |= StateFlags::AGENT;
}
if self.role.is_some() {
flags |= StateFlags::ROLE;
@@ -1486,7 +1486,7 @@ bitflags::bitflags! {
const SESSION_EMPTY = 1 << 1;
const SESSION = 1 << 2;
const RAG = 1 << 3;
- const BOT = 1 << 4;
+ const AGENT = 1 << 4;
}
}
diff --git a/src/repl/mod.rs b/src/repl/mod.rs
index 8083820..eb4e1d9 100644
--- a/src/repl/mod.rs
+++ b/src/repl/mod.rs
@@ -40,12 +40,12 @@ lazy_static! {
ReplCommand::new(
".prompt",
"Create a temporary role using a prompt",
- AssertState::False(StateFlags::SESSION | StateFlags::BOT)
+ AssertState::False(StateFlags::SESSION | StateFlags::AGENT)
),
ReplCommand::new(
".role",
"Switch to a specific role",
- AssertState::False(StateFlags::SESSION | StateFlags::BOT)
+ AssertState::False(StateFlags::SESSION | StateFlags::AGENT)
),
ReplCommand::new(
".info role",
@@ -90,7 +90,7 @@ lazy_static! {
ReplCommand::new(
".rag",
"Init or use a rag",
- AssertState::False(StateFlags::BOT)
+ AssertState::False(StateFlags::AGENT)
),
ReplCommand::new(
".info rag",
@@ -100,23 +100,23 @@ lazy_static! {
ReplCommand::new(
".exit rag",
"Leave the rag",
- AssertState::TrueFalse(StateFlags::RAG, StateFlags::BOT),
+ AssertState::TrueFalse(StateFlags::RAG, StateFlags::AGENT),
),
ReplCommand::new(".agent", "Use a agent", AssertState::bare()),
ReplCommand::new(
".info agent",
"View agent info",
- AssertState::True(StateFlags::BOT),
+ AssertState::True(StateFlags::AGENT),
),
ReplCommand::new(
".starter",
"Use the conversation starter",
- AssertState::True(StateFlags::BOT)
+ AssertState::True(StateFlags::AGENT)
),
ReplCommand::new(
".exit agent",
"Leave the agent",
- AssertState::True(StateFlags::BOT)
+ AssertState::True(StateFlags::AGENT)
),
ReplCommand::new(
".file",