llm, add a safeguard when a model causes swap-stopper to reset ollama.

This commit is contained in:
me committed 2026-10-22 11:58:16 -07:00
1 parent 295b6b3d19
commit f6fd08f966
1 file changed
+7
+7
View File
@@ -913,11 +913,18 @@
curl -s http://localhost:11434/api/generate \
-d '{"model":"'$model'","prompt":"","stream":false,"keep_alive":1'$context'}' \
>/dev/null 2>&1
status=$?
hdd="`ollama ls | grep $model | awk '{print $3 $4}'`"
ram="`ollama ps | grep $model | awk '{print $3 $4}'`"
ctx="`ollama ps | grep $model | awk '{print $7}'`"
if [[ "$status" != 0 ]]; then
ram="TOO LARGE $ram"
ctx="FAIL $ctx"
sleep 10
fi
printf "$spacing\n" "$model" "$hdd" "$ctx" "$ram"
ollama stop $model >/dev/null 2>&1