#!/usr/bin/env bash
# ops/node2_models_pull.sh
# Pull minimal required models for NODA2 P0 (Vision) + P1 (Text)
# Usage: ./ops/node2_models_pull.sh
set -euo pipefail

OLLAMA_URL="${OLLAMA_URL:-http://localhost:11434}"

echo "=== NODA2 Model Pull Script ==="
echo "Ollama URL: $OLLAMA_URL"
echo ""

pull_model() {
  local model="$1"
  local label="$2"
  echo "→ Pulling $label ($model)..."
  if ollama list 2>/dev/null | grep -q "^${model%:*}"; then
    echo "  SKIP — already present"
  else
    ollama pull "$model"
    echo "  DONE"
  fi
}

# P0: Vision — llava:13b (already present, verify)
echo "--- P0: Vision models ---"
pull_model "llava:13b" "LLaVA 13B (P0 fallback vision)"

# P1 RECOMMENDED: Better vision quality (uncomment when ready)
# pull_model "qwen3-vl:8b" "Qwen3-VL 8B (recommended vision)"

# P1: Primary text model (already present, verify)
echo ""
echo "--- P1: Text models ---"
pull_model "qwen3.5:35b-a3b" "Qwen3.5 35B A3B (primary LLM)"

echo ""
echo "=== Done. Current models ==="
ollama list 2>/dev/null || echo "(ollama not in PATH, check manually)"
