From 9be15a2c00307bc669e3fa3c3e293d9e0f02158a Mon Sep 17 00:00:00 2001 From: Ayo Date: Thu, 2 Oct 2025 12:31:17 +0200 Subject: [PATCH] feat: add coder --- ai-coder.sh | 35 +++++++++++++++++++++++++++++++++++ ayo.sh | 3 +++ 2 files changed, 38 insertions(+) create mode 100755 ai-coder.sh diff --git a/ai-coder.sh b/ai-coder.sh new file mode 100755 index 0000000..22f0c20 --- /dev/null +++ b/ai-coder.sh @@ -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 diff --git a/ayo.sh b/ayo.sh index 594c400..473ac2d 100755 --- a/ayo.sh +++ b/ayo.sh @@ -75,6 +75,9 @@ case $1 in translate) . ${scripts_dir}/ai-translate.sh "$@" ;; + coder) + . ${scripts_dir}/ai-coder.sh "$@" + ;; ai) . ${scripts_dir}/ai.sh "$@" ;;