2024-04-13 11:50:10 +00:00
|
|
|
#compdef aichat
|
|
|
|
|
|
|
|
autoload -U is-at-least
|
|
|
|
|
|
|
|
_aichat() {
|
|
|
|
typeset -A opt_args
|
|
|
|
typeset -a _arguments_options
|
|
|
|
local ret=1
|
|
|
|
|
|
|
|
if is-at-least 5.2; then
|
|
|
|
_arguments_options=(-s -S -C)
|
|
|
|
else
|
|
|
|
_arguments_options=(-s -C)
|
|
|
|
fi
|
|
|
|
|
|
|
|
local context curcontext="$curcontext" state line
|
2024-06-23 15:09:47 +00:00
|
|
|
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' \
|
2024-06-13 11:41:54 +00:00
|
|
|
'--save-session[Forces the session to be saved]' \
|
2024-06-23 15:09:47 +00:00
|
|
|
'-a[Start a agent]:AGENT:->agents' \
|
|
|
|
'--agent[Start a agent]:AGENT:->agents' \
|
|
|
|
'-R[Start a RAG]:RAG:->rags' \
|
|
|
|
'--rag[Start a RAG]:RAG:->rags' \
|
2024-05-07 02:17:40 +00:00
|
|
|
'--serve[Serve the LLM API and WebAPP]' \
|
2024-04-20 13:07:30 +00:00
|
|
|
'-e[Execute commands in natural language]' \
|
|
|
|
'--execute[Execute commands in natural language]' \
|
|
|
|
'-c[Output code only]' \
|
|
|
|
'--code[Output code only]' \
|
2024-06-23 23:37:50 +00:00
|
|
|
'*-f[Include files with the message]:FILE:_files' \
|
|
|
|
'*--file[Include files with the message]:FILE:_files' \
|
|
|
|
'-S[Turn off stream mode]' \
|
|
|
|
'--no-stream[Turn off stream mode]' \
|
|
|
|
'-w[Control text wrapping (no, auto, <max-width>)]:WRAP: ' \
|
|
|
|
'--wrap[Control text wrapping (no, auto, <max-width>)]:WRAP: ' \
|
2024-04-20 13:07:30 +00:00
|
|
|
'-H[Turn off syntax highlighting]' \
|
|
|
|
'--no-highlight[Turn off syntax highlighting]' \
|
2024-04-13 11:50:10 +00:00
|
|
|
'--light-theme[Use light theme]' \
|
2024-04-20 13:07:30 +00:00
|
|
|
'--dry-run[Display the message without sending it]' \
|
2024-04-20 22:26:29 +00:00
|
|
|
'--info[Display information]' \
|
2024-06-17 11:54:24 +00:00
|
|
|
'--list-models[List all available chat models]' \
|
2024-06-13 11:41:54 +00:00
|
|
|
'--list-roles[List all roles]' \
|
|
|
|
'--list-sessions[List all sessions]' \
|
2024-06-21 22:54:03 +00:00
|
|
|
'--list-agents[List all agents]' \
|
2024-06-13 11:41:54 +00:00
|
|
|
'--list-rags[List all RAGs]' \
|
2024-04-13 11:50:10 +00:00
|
|
|
'-h[Print help]' \
|
|
|
|
'--help[Print help]' \
|
|
|
|
'-V[Print version]' \
|
|
|
|
'--version[Print version]' \
|
|
|
|
'*::text -- Input text:' \
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
_arguments "${_arguments_options[@]}" $common \
|
|
|
|
&& ret=0
|
|
|
|
case $state in
|
2024-06-21 22:54:03 +00:00
|
|
|
models|roles|sessions|agents|rags)
|
2024-04-13 11:50:10 +00:00
|
|
|
local -a values expl
|
|
|
|
values=( ${(f)"$(_call_program values aichat --list-$state)"} )
|
|
|
|
_wanted values expl $state compadd -a values && ret=0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
return ret
|
|
|
|
}
|
|
|
|
|
|
|
|
(( $+functions[_aichat_commands] )) ||
|
|
|
|
_aichat_commands() {
|
|
|
|
local commands; commands=()
|
|
|
|
_describe -t commands 'aichat commands' commands "$@"
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ "$funcstack[1]" = "_aichat" ]; then
|
|
|
|
_aichat "$@"
|
|
|
|
else
|
|
|
|
compdef _aichat aichat
|
|
|
|
fi
|