#!/bin/bash # Wrapper: fix line endings, detect Windows host IP, run TTS setup SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" LLMS_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" # Fix CRLF sed -i 's/\r$//' "$LLMS_DIR/setup-tts.sh" 2>/dev/null # Detect Windows host IP via default gateway GW=$(ip route show default 2>/dev/null | awk '{print $3}' | head -1) if [ -n "$GW" ] && curl -s --max-time 2 "http://${GW}:11434/api/tags" >/dev/null 2>&1; then export OLLAMA_HOST="http://${GW}:11434" echo "Ollama found at $OLLAMA_HOST (via default gateway)" elif curl -s --max-time 2 "http://localhost:11434/api/tags" >/dev/null 2>&1; then export OLLAMA_HOST="http://localhost:11434" echo "Ollama found at $OLLAMA_HOST" else echo "WARNING: Ollama not found. The script may fail at prerequisite check." fi export HF_MIRROR="${HF_MIRROR:-https://huggingface.co}" cd "$LLMS_DIR" exec bash setup-tts.sh