#!/bin/bash
# Test streaming SSE from chat proxy
echo "=== Stream test ==="
timeout 15 curl -sN \
  http://localhost:9090/api/proxy/chat \
  -H 'Content-Type: application/json' \
  -d '{"messages":[{"role":"user","content":"Say hi in one word"}],"stream":true}' \
  2>&1 | tee /tmp/stream_test.txt

echo ""
echo "=== Stream output size ==="
wc -c /tmp/stream_test.txt
echo "=== Has DONE ==="
grep -c DONE /tmp/stream_test.txt
echo "=== Last 3 lines ==="
tail -3 /tmp/stream_test.txt
