#!/bin/bash # Download the smallest starter model for each runtime (same family on all three, so they can be compared). # Models already present are skipped quickly by the runtimes themselves. . "$(dirname "$0")/lib.sh" [ -x "$AGENT_BIN" ] || die "the agent is not installed ($AGENT_BIN); run the 'agent' step first" # With an external disk connected, ask where the starter model should live: the machine (default) or the disk. # Only when someone can answer on the terminal; 20 seconds, then the machine. ask_store() { # model ls "$EXT_ROOT"/*/wxch-models/.wxch-models >/dev/null 2>&1 || { echo internal; return; } # no external disk connected { : < /dev/tty; } 2>/dev/null || { echo internal; return; } printf '[wxch] %s: keep it on this machine (default) or on the external disk? [m/e] (20 s, then: machine) ' "$1" > /dev/tty if read -r -t 20 ans < /dev/tty; then case "$ans" in e|E|ext*|EXT*) echo external; return ;; esac fi echo internal } pull() { # runtime model store="$(ask_store "$2")" say "downloading $2 with $1 (stored: $store)" as_owner "$AGENT_BIN" pull "$1" "$2" --store "$store" || die "could not download $2 with $1" } step_enabled ollama && pull ollama "$MODEL_OLLAMA" step_enabled lmstudio && pull lmstudio "$MODEL_LMSTUDIO" step_enabled vllm && pull vllm "$MODEL_VLLM" say "starter models are in place"