#!/usr/bin/env bash
# Launch the AVC phone agent. Reuses the pipecat-run venv (has pipecat-ai 1.3.0,
# faster-whisper, kokoro-onnx, fastapi) and the CUDA12 libs we installed into it.
set -euo pipefail

HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
VENV="/home/tocmo0nlord/pipecat-run/.venv"

# faster-whisper (ctranslate2) needs the CUDA12 cublas + cudnn shared libs at runtime.
NV="$VENV/lib/python3.13/site-packages/nvidia"
export LD_LIBRARY_PATH="$NV/cublas/lib:$NV/cudnn/lib:${LD_LIBRARY_PATH:-}"

# Load .env if present (Twilio creds, PUBLIC_HOST, model overrides).
if [ -f "$HERE/.env" ]; then
  set -a; . "$HERE/.env"; set +a
fi

cd "$HERE"
exec "$VENV/bin/python" server.py
