#!/bin/bash
echo "=== Test 1: Chat only ==="
curl -s -X POST http://localhost:9090/api/proxy/chat \
  -H "Content-Type: application/json" \
  -d '{"messages":[{"role":"user","content":"Say hello in one sentence."}],"stream":false}' | head -c 500
echo

echo
echo "=== Test 2: TTS sidecar health ==="
curl -s http://localhost:9090/api/tts/sidecar/health
echo

echo
echo "=== Test 3: Chat+Speak pipeline ==="
curl -s -X POST http://localhost:9090/api/chat/speak \
  -H "Content-Type: application/json" \
  -d '{"messages":[{"role":"user","content":"Say hello in one short sentence."}],"tts_voice":"vivian","tts_language":"en"}' | python3 -c "
import sys, json
d = json.load(sys.stdin)
print('Text:', d.get('text','')[:200])
print('Audio bytes:', len(d.get('audio_b64','')) if d.get('audio_b64') else 'NONE')
print('Timings:', d.get('timings',{}))
if d.get('error'): print('ERROR:', d['error'])
"
echo

echo
echo "=== Test 4: Memory usage ==="
free -h | head -2
echo
docker stats --no-stream --format "table {{.Name}}\t{{.MemUsage}}"
