From d46ca4e9ec27256f95a2ad56a500bedb729818e5 Mon Sep 17 00:00:00 2001 From: Ayo Date: Tue, 26 Aug 2025 10:11:27 +0200 Subject: [PATCH] feat(ai): use remote ollama host --- ai-coder.sh | 10 ++++++---- ai.sh | 14 +++++++++----- example.conf | 3 ++- 3 files changed, 17 insertions(+), 10 deletions(-) mode change 100644 => 100755 ai-coder.sh diff --git a/ai-coder.sh b/ai-coder.sh old mode 100644 new mode 100755 index 8a10dd1..8a56aa8 --- a/ai-coder.sh +++ b/ai-coder.sh @@ -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 diff --git a/ai.sh b/ai.sh index 9805d62..ebab2cd 100755 --- a/ai.sh +++ b/ai.sh @@ -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 diff --git a/example.conf b/example.conf index cbbd199..d2f743a 100644 --- a/example.conf +++ b/example.conf @@ -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"