summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-06-13 19:41:54 +0800
committerGitHub <noreply@github.com>2024-06-13 19:41:54 +0800
commitf9847475b8eae99a70f16dc63bac67da2632474a (patch)
tree032c9eb02540cf8644a2df103d8a45dfc54557be /scripts
parent255b194bcc538b2557caa60c5b607b4c4bfc0abd (diff)
downloadaichat-f9847475b8eae99a70f16dc63bac67da2632474a.tar.gz
feat: add rag and bot related cli options (#595)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/completions/aichat.bash10
-rw-r--r--scripts/completions/aichat.fish10
-rw-r--r--scripts/completions/aichat.nu20
-rw-r--r--scripts/completions/aichat.ps115
-rw-r--r--scripts/completions/aichat.zsh13
5 files changed, 55 insertions, 13 deletions
diff --git a/scripts/completions/aichat.bash b/scripts/completions/aichat.bash
index cb9b708..adfe57d 100644
--- a/scripts/completions/aichat.bash
+++ b/scripts/completions/aichat.bash
@@ -19,7 +19,7 @@ _aichat() {
case "${cmd}" in
aichat)
- opts="-m -r -s -e -c -f -H -S -w -h -V --model --prompt --role --session --save-session --serve --execute --code --file --no-highlight --no-stream --wrap --light-theme --dry-run --info --list-models --list-roles --list-sessions --help --version"
+ opts="-m -r -s -b -e -c -f -H -S -w -h -V --model --prompt --role --session --save-session --bot --rag --serve --execute --code --file --no-highlight --no-stream --wrap --light-theme --dry-run --info --list-models --list-roles --list-sessions --list-bots --list-rags --help --version"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -61,6 +61,14 @@ _aichat() {
COMPREPLY=($(compgen -W "$("$1" --list-sessions)" -- "${cur}"))
return 0
;;
+ -b|--bot)
+ COMPREPLY=($(compgen -W "$("$1" --list-bots)" -- "${cur}"))
+ return 0
+ ;;
+ --rag)
+ COMPREPLY=($(compgen -W "$("$1" --list-rags)" -- "${cur}"))
+ return 0
+ ;;
-f|--file)
local oldifs
if [[ -v IFS ]]; then
diff --git a/scripts/completions/aichat.fish b/scripts/completions/aichat.fish
index 9da7391..d05b4e6 100644
--- a/scripts/completions/aichat.fish
+++ b/scripts/completions/aichat.fish
@@ -2,9 +2,11 @@ complete -c aichat -s m -l model -x -a "(aichat --list-models)" -d 'Select a LLM
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 bot -x -a"(aichat --list-bots)" -d 'Start a bot' -r
+complete -c aichat -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 save-session -d 'Forces the session to be saved'
complete -c aichat -l serve -d 'Serve the LLM API and WebAPP'
complete -c aichat -s e -l execute -d 'Execute commands in natural language'
complete -c aichat -s c -l code -d 'Output code only'
@@ -14,7 +16,9 @@ complete -c aichat -l light-theme -d 'Use light theme'
complete -c aichat -l dry-run -d 'Display the message without sending it'
complete -c aichat -l info -d 'Display information'
complete -c aichat -l list-models -d 'List all available models'
-complete -c aichat -l list-roles -d 'List all available roles'
-complete -c aichat -l list-sessions -d 'List all available sessions'
+complete -c aichat -l list-roles -d 'List all roles'
+complete -c aichat -l list-sessions -d 'List all sessions'
+complete -c aichat -l list-bots -d 'List all bots'
+complete -c aichat -l list-rags -d 'List all RAGs'
complete -c aichat -s h -l help -d 'Print help'
complete -c aichat -s V -l version -d 'Print version'
diff --git a/scripts/completions/aichat.nu b/scripts/completions/aichat.nu
index 89ebb35..ec4b083 100644
--- a/scripts/completions/aichat.nu
+++ b/scripts/completions/aichat.nu
@@ -22,6 +22,18 @@ module completions {
| parse "{value}"
}
+ def "nu-complete aichat bot" [] {
+ ^aichat --list-bots |
+ | lines
+ | parse "{value}"
+ }
+
+ def "nu-complete aichat rag" [] {
+ ^aichat --list-rags |
+ | lines
+ | parse "{value}"
+ }
+
# All-in-one chat and copilot CLI that integrates 10+ AI platforms
export extern aichat [
--model(-m): string@"nu-complete aichat model" # Select a LLM model
@@ -29,6 +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
+ --bot(-b): string@"nu-complete aichat bot" # Start a bot
+ --rag: 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
@@ -40,8 +54,10 @@ module completions {
--dry-run # Display the message without sending it
--info # Display information
--list-models # List all available models
- --list-roles # List all available roles
- --list-sessions # List all available sessions
+ --list-roles # List all roles
+ --list-sessions # List all sessions
+ --list-bots # List all bots
+ --list-rags # List all RAGs
...text: string # Input text
--help(-h) # Print help
--version(-V) # Print version
diff --git a/scripts/completions/aichat.ps1 b/scripts/completions/aichat.ps1
index 78f2f02..093f53f 100644
--- a/scripts/completions/aichat.ps1
+++ b/scripts/completions/aichat.ps1
@@ -27,11 +27,14 @@ Register-ArgumentCompleter -Native -CommandName 'aichat' -ScriptBlock {
[CompletionResult]::new('--role', '--role', [CompletionResultType]::ParameterName, 'Select a role')
[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 bot')
+ [CompletionResult]::new('--bot', '--bot', [CompletionResultType]::ParameterName, 'Start a bot')
+ [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')
[CompletionResult]::new('-w', '-w', [CompletionResultType]::ParameterName, 'Control text wrapping (no, auto, <max-width>)')
[CompletionResult]::new('--wrap', '--wrap', [CompletionResultType]::ParameterName, 'Control text wrapping (no, auto, <max-width>)')
- [CompletionResult]::new('--save-session', '--save-session', [CompletionResultType]::ParameterName, 'Forces the session to be saved')
[CompletionResult]::new('--serve', '--serve', [CompletionResultType]::ParameterName, 'Serve the LLM API and WebAPP')
[CompletionResult]::new('-e', '-e', [CompletionResultType]::ParameterName, 'Execute commands in natural language')
[CompletionResult]::new('--execute', '--execute', [CompletionResultType]::ParameterName, 'Execute commands in natural language')
@@ -45,8 +48,10 @@ Register-ArgumentCompleter -Native -CommandName 'aichat' -ScriptBlock {
[CompletionResult]::new('--dry-run', '--dry-run', [CompletionResultType]::ParameterName, 'Display the message without sending it')
[CompletionResult]::new('--info', '--info', [CompletionResultType]::ParameterName, 'Display information')
[CompletionResult]::new('--list-models', '--list-models', [CompletionResultType]::ParameterName, 'List all available models')
- [CompletionResult]::new('--list-roles', '--list-roles', [CompletionResultType]::ParameterName, 'List all available roles')
- [CompletionResult]::new('--list-sessions', '--list-sessions', [CompletionResultType]::ParameterName, 'List all available sessions')
+ [CompletionResult]::new('--list-roles', '--list-roles', [CompletionResultType]::ParameterName, 'List all roles')
+ [CompletionResult]::new('--list-sessions', '--list-sessions', [CompletionResultType]::ParameterName, 'List all sessions')
+ [CompletionResult]::new('--list-bots', '--list-bots', [CompletionResultType]::ParameterName, 'List all bots')
+ [CompletionResult]::new('--list-rags', '--list-rags', [CompletionResultType]::ParameterName, 'List all RAGs')
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
[CompletionResult]::new('-V', '-V', [CompletionResultType]::ParameterName, 'Print version')
@@ -71,6 +76,10 @@ Register-ArgumentCompleter -Native -CommandName 'aichat' -ScriptBlock {
$completions = Get-AichatValues "--list-roles"
} elseif ($flag -eq "-s" -or $flag -eq "--session") {
$completions = Get-AichatValues "--list-sessions"
+ } elseif ($flag -eq "-b" -or $flag -eq "--bot") {
+ $completions = Get-AichatValues "--list-bots"
+ } elseif ($flag -eq "--rag") {
+ $completions = Get-AichatValues "--list-rags"
} elseif ($flag -eq "-f" -or $flag -eq "--file") {
$completions = @()
}
diff --git a/scripts/completions/aichat.zsh b/scripts/completions/aichat.zsh
index 043d1db..ae39481 100644
--- a/scripts/completions/aichat.zsh
+++ b/scripts/completions/aichat.zsh
@@ -22,11 +22,14 @@ _aichat() {
'--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 bot]:BOT:->bots' \
+'--bot=[Start a bot]:BOT:->bots' \
+'--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: ' \
-'--save-session[Forces the session to be saved]' \
'--serve[Serve the LLM API and WebAPP]' \
'-e[Execute commands in natural language]' \
'--execute[Execute commands in natural language]' \
@@ -40,8 +43,10 @@ _aichat() {
'--dry-run[Display the message without sending it]' \
'--info[Display information]' \
'--list-models[List all available models]' \
-'--list-roles[List all available roles]' \
-'--list-sessions[List all available sessions]' \
+'--list-roles[List all roles]' \
+'--list-sessions[List all sessions]' \
+'--list-bots[List all bots]' \
+'--list-rags[List all RAGs]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
@@ -53,7 +58,7 @@ _aichat() {
_arguments "${_arguments_options[@]}" $common \
&& ret=0
case $state in
- models|roles|sessions)
+ models|roles|sessions|bots|rags)
local -a values expl
values=( ${(f)"$(_call_program values aichat --list-$state)"} )
_wanted values expl $state compadd -a values && ret=0