feat(ai): use remote ollama host
This commit is contained in:
parent
fe2d9514ce
commit
d46ca4e9ec
3 changed files with 17 additions and 10 deletions
10
ai-coder.sh
Normal file → Executable file
10
ai-coder.sh
Normal file → Executable file
|
@ -4,6 +4,8 @@
|
||||||
model=$coder
|
model=$coder
|
||||||
modelfile=$coder_modelfile
|
modelfile=$coder_modelfile
|
||||||
|
|
||||||
|
host=$ollama_remote_host
|
||||||
|
|
||||||
# Initialize variables
|
# Initialize variables
|
||||||
typora_flag=false
|
typora_flag=false
|
||||||
other_args=""
|
other_args=""
|
||||||
|
@ -39,20 +41,20 @@ fi
|
||||||
|
|
||||||
if ! [ "$other_args" = "" ]; then
|
if ! [ "$other_args" = "" ]; then
|
||||||
if [ "$other_args" = "sleep" ]; then
|
if [ "$other_args" = "sleep" ]; then
|
||||||
ollama stop $model
|
OLLAMA_HOST=$host ollama stop $model
|
||||||
elif [ "$other_args" = "init" ]; then
|
elif [ "$other_args" = "init" ]; then
|
||||||
ollama create "$model" -f "$modelfile"
|
ollama create "$model" -f "$modelfile"
|
||||||
else
|
else
|
||||||
# If -t flag is set, use typora to display output
|
# If -t flag is set, use typora to display output
|
||||||
if [ "$typora_flag" = true ]; then
|
if [ "$typora_flag" = true ]; then
|
||||||
tempfile="$(mktemp)"
|
tempfile="$(mktemp)"
|
||||||
ollama run $model "$other_args" --hidethinking > $tempfile
|
OLLAMA_HOST=$host ollama run $model "$other_args" --hidethinking > $tempfile
|
||||||
typora $tempfile
|
typora $tempfile
|
||||||
else
|
else
|
||||||
# If no -t flag, just run the command normally
|
# 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
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
ollama run $model --hidethinking
|
OLLAMA_HOST=$host ollama run $model --hidethinking
|
||||||
fi
|
fi
|
||||||
|
|
14
ai.sh
14
ai.sh
|
@ -1,6 +1,8 @@
|
||||||
# Load config
|
# Load config
|
||||||
. ${HOME}/ayo.conf
|
. ${HOME}/ayo.conf
|
||||||
|
|
||||||
|
host=$ollama_remote_host
|
||||||
|
|
||||||
model=$helper
|
model=$helper
|
||||||
modelfile=$helper_modelfile
|
modelfile=$helper_modelfile
|
||||||
|
|
||||||
|
@ -44,8 +46,10 @@ if ! [ "$other_args" = "" ]; then
|
||||||
open-webui serve
|
open-webui serve
|
||||||
python --version
|
python --version
|
||||||
deactivate
|
deactivate
|
||||||
|
elif [ "$other_args" = "remote" ]; then
|
||||||
|
export OLLAMA_HOST=192.168.0.6
|
||||||
elif [ "$other_args" = "init" ]; then
|
elif [ "$other_args" = "init" ]; then
|
||||||
ollama create $model -f $modelfile
|
OLLAMA_HOST=$host ollama create $model -f $modelfile
|
||||||
elif [ "$other_args" = "wake" ]; then
|
elif [ "$other_args" = "wake" ]; then
|
||||||
. $HOME/llm_env/bin/activate
|
. $HOME/llm_env/bin/activate
|
||||||
|
|
||||||
|
@ -62,19 +66,19 @@ if ! [ "$other_args" = "" ]; then
|
||||||
echo $ZES_ENABLE_SYSMAN
|
echo $ZES_ENABLE_SYSMAN
|
||||||
echo $SYCL_CACHE_PERSISTENT
|
echo $SYCL_CACHE_PERSISTENT
|
||||||
elif [ "$other_args" = "sleep" ]; then
|
elif [ "$other_args" = "sleep" ]; then
|
||||||
ollama stop $model
|
OLLAMA_HOST=$host ollama stop $model
|
||||||
else
|
else
|
||||||
# If -t flag is set, use typora to display output
|
# If -t flag is set, use typora to display output
|
||||||
if [ "$typora_flag" = true ]; then
|
if [ "$typora_flag" = true ]; then
|
||||||
tempfile="$(mktemp)"
|
tempfile="$(mktemp)"
|
||||||
ollama run $model "$other_args" > $tempfile
|
OLLAMA_HOST=$host ollama run $model "$other_args" > $tempfile
|
||||||
typora $tempfile
|
typora $tempfile
|
||||||
else
|
else
|
||||||
# If no -t flag, just run the command normally
|
# If no -t flag, just run the command normally
|
||||||
ollama run $model "$other_args"
|
OLLAMA_HOST=$host ollama run $model "$other_args"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
ollama run $model
|
OLLAMA_HOST=$host ollama run $model
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -4,8 +4,9 @@ archive_dir="${HOME}/Notes/Archive"
|
||||||
scripts_dir="${HOME}/Projects/scripts"
|
scripts_dir="${HOME}/Projects/scripts"
|
||||||
editor="vim"
|
editor="vim"
|
||||||
|
|
||||||
|
ollama_remote_host="192.168.0.1234"
|
||||||
coder="coder:latest"
|
coder="coder:latest"
|
||||||
coder_modelfile="${HOME}/Projects/llm-prompts/Modelfile-coder"
|
coder_modelfile="${HOME}/Projects/llm-prompts/Modelfile-coder-lite"
|
||||||
|
|
||||||
helper="helper:latest"
|
helper="helper:latest"
|
||||||
helper_modelfile="${HOME}/Projects/llm-prompts/Modelfile-helper"
|
helper_modelfile="${HOME}/Projects/llm-prompts/Modelfile-helper"
|
||||||
|
|
Loading…
Reference in a new issue