feat: add coder

This commit is contained in:
Ayo Ayco 2025-10-02 12:31:17 +02:00
parent b1a251e50f
commit 9be15a2c00
2 changed files with 38 additions and 0 deletions

35
ai-coder.sh Executable file
View file

@ -0,0 +1,35 @@
#! /bin/bash
# Load config
. ${HOME}/ayo.conf
host=$ollama_remote_host
model=$coder
modelfile=$coder_modelfile
# Initialize variables
typora_flag=false
other_args=${@:2}
# TODO: extract typora flag
if ! [ "$other_args" = "" ]; then
if [ "$2" = "init" ]; then
OLLAMA_HOST=$host ollama create $model -f $modelfile
elif [ "$2" = "sleep" ]; then
OLLAMA_HOST=$host ollama stop $model
else
# If -t flag is set, use typora to display output
if [ "$typora_flag" = true ]; then
tempfile="$(mktemp)"
OLLAMA_HOST=$host ollama run $model "$other_args" > $tempfile
typora $tempfile > /dev/null 2>/dev/null &
else
# If no -t flag, just run the command normally
OLLAMA_HOST=$host ollama run $model "$other_args"
fi
fi
else
OLLAMA_HOST=$host ollama run $model --think=false
fi

3
ayo.sh
View file

@ -75,6 +75,9 @@ case $1 in
translate) translate)
. ${scripts_dir}/ai-translate.sh "$@" . ${scripts_dir}/ai-translate.sh "$@"
;; ;;
coder)
. ${scripts_dir}/ai-coder.sh "$@"
;;
ai) ai)
. ${scripts_dir}/ai.sh "$@" . ${scripts_dir}/ai.sh "$@"
;; ;;