Files
timmy-home/scripts/hermes_gemma4_ollama_chat.sh

32 lines
887 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
set -euo pipefail
SESSION_ID=""
echo "Hermes -> Gemma4 via local Ollama"
echo "Type /exit to quit. Type /session to see the current Hermes session id."
echo
while true; do
printf 'gemma4-hermes '
IFS= read -r user || exit 0
[ -z "$user" ] && continue
if [ "$user" = "/exit" ] || [ "$user" = "/quit" ]; then
echo "Goodbye."
exit 0
fi
if [ "$user" = "/session" ]; then
echo "${SESSION_ID:-'(no session yet)'}"
echo
continue
fi
if [ -n "$SESSION_ID" ]; then
OUT=$(/Users/apayne/.timmy/scripts/hermes_gemma4_ollama_once.py "$user" "$SESSION_ID")
else
OUT=$(/Users/apayne/.timmy/scripts/hermes_gemma4_ollama_once.py "$user")
fi
NEW_SESSION=$(printf '%s
' "$OUT" | awk -F= '/^SESSION_ID=/{print $2}')
[ -n "$NEW_SESSION" ] && SESSION_ID="$NEW_SESSION"
printf '%s
' "$OUT" | sed '1,/^---RESPONSE---$/d'
echo
done