feat(ai): use remote ollama host

This commit is contained in:
Ayo Ayco 2025-08-26 10:11:27 +02:00
parent fe2d9514ce
commit d46ca4e9ec
3 changed files with 17 additions and 10 deletions

10
ai-coder.sh Normal file → Executable file
View file

@ -4,6 +4,8 @@
model=$coder
modelfile=$coder_modelfile
host=$ollama_remote_host
# Initialize variables
typora_flag=false
other_args=""
@ -39,20 +41,20 @@ fi
if ! [ "$other_args" = "" ]; then
if [ "$other_args" = "sleep" ]; then
ollama stop $model
OLLAMA_HOST=$host ollama stop $model
elif [ "$other_args" = "init" ]; then
ollama create "$model" -f "$modelfile"
else
# If -t flag is set, use typora to display output
if [ "$typora_flag" = true ]; then
tempfile="$(mktemp)"
ollama run $model "$other_args" --hidethinking > $tempfile
OLLAMA_HOST=$host ollama run $model "$other_args" --hidethinking > $tempfile
typora $tempfile
else
# If no -t flag, just run the command normally
ollama run $model "$other_args" --hidethinking
OLLAMA_HOST=$host ollama run $model "$other_args" --hidethinking
fi
fi
else
ollama run $model --hidethinking
OLLAMA_HOST=$host ollama run $model --hidethinking
fi

14
ai.sh
View file

@ -1,6 +1,8 @@
# Load config
. ${HOME}/ayo.conf
host=$ollama_remote_host
model=$helper
modelfile=$helper_modelfile
@ -44,8 +46,10 @@ if ! [ "$other_args" = "" ]; then
open-webui serve
python --version
deactivate
elif [ "$other_args" = "remote" ]; then
export OLLAMA_HOST=192.168.0.6
elif [ "$other_args" = "init" ]; then
ollama create $model -f $modelfile
OLLAMA_HOST=$host ollama create $model -f $modelfile
elif [ "$other_args" = "wake" ]; then
. $HOME/llm_env/bin/activate
@ -62,19 +66,19 @@ if ! [ "$other_args" = "" ]; then
echo $ZES_ENABLE_SYSMAN
echo $SYCL_CACHE_PERSISTENT
elif [ "$other_args" = "sleep" ]; then
ollama stop $model
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 run $model "$other_args" > $tempfile
OLLAMA_HOST=$host ollama run $model "$other_args" > $tempfile
typora $tempfile
else
# If no -t flag, just run the command normally
ollama run $model "$other_args"
OLLAMA_HOST=$host ollama run $model "$other_args"
fi
fi
else
ollama run $model
OLLAMA_HOST=$host ollama run $model
fi

View file

@ -4,8 +4,9 @@ archive_dir="${HOME}/Notes/Archive"
scripts_dir="${HOME}/Projects/scripts"
editor="vim"
ollama_remote_host="192.168.0.1234"
coder="coder:latest"
coder_modelfile="${HOME}/Projects/llm-prompts/Modelfile-coder"
coder_modelfile="${HOME}/Projects/llm-prompts/Modelfile-coder-lite"
helper="helper:latest"
helper_modelfile="${HOME}/Projects/llm-prompts/Modelfile-helper"