22 lines
646 B
Bash
22 lines
646 B
Bash
#!/bin/bash
|
|
# Convenience wrapper: run discovery and restart opencode
|
|
# Place on TrueNAS and run via cron or manually
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
CONFIG_PATH="${OPENCODE_CONFIG:-$HOME/.config/opencode/opencode.log}"
|
|
API_KEY="${NINEROUTER_API_KEY:-}"
|
|
BASE_URL="${NINEROUTER_BASE_URL:-https://ollama.wilddragon.net/v1}"
|
|
|
|
if [ -z "$API_KEY" ]; then
|
|
echo "ERROR: Set NINEROUTER_API_KEY" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "=== 9Router Model Discovery ===" >&2
|
|
python3 "$SCRIPT_DIR/discover_models.py" \
|
|
--config "$CONFIG_PATH" \
|
|
--api-key "$API_KEY" \
|
|
--base-url "$BASE_URL" \
|
|
"$@"
|
|
echo "=== Done ===" >&2
|