#!/bin/bash
# Test proxy_tts from host

echo "=== Test 1: curl with JSON ==="
curl -s -w '\nHTTP: %{http_code} Size: %{size_download}\n' \
  -o /tmp/proxy_test1.wav \
  http://localhost:9090/api/proxy/tts \
  -H 'Content-Type: application/json' \
  -d '{"input":"Hello, this is a quick test.","voice":"Vivian","language":"en","speed":1.0}'

echo "=== Content of response ==="
file /tmp/proxy_test1.wav 2>/dev/null || echo "No file"
head -c 100 /tmp/proxy_test1.wav 2>/dev/null | xxd | head -3

echo ""
echo "=== Test 2: curl with --data-raw ==="
curl -s -w '\nHTTP: %{http_code} Size: %{size_download}\n' \
  -o /tmp/proxy_test2.wav \
  http://localhost:9090/api/proxy/tts \
  -H 'Content-Type: application/json' \
  --data-raw '{"input":"test"}'

echo "=== Debug: dashboard logs ==="
docker logs sudx-dashboard 2>&1 | tail -5
