49 lines
1.4 KiB
Bash
Executable File
49 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Test script for DECTalk server API
|
|
|
|
BASE_URL="${1:-http://127.0.0.1:3000}"
|
|
|
|
echo "🧪 Testing DECTalk Server at $BASE_URL"
|
|
echo ""
|
|
|
|
# Test 1: Health check
|
|
echo "1️⃣ Testing /health endpoint..."
|
|
curl -s "$BASE_URL/health" | jq '.' || echo "❌ Health check failed"
|
|
echo ""
|
|
|
|
# Test 2: Engine info
|
|
echo "2️⃣ Testing /engine endpoint..."
|
|
curl -s "$BASE_URL/engine" | jq '.' || echo "❌ Engine info failed"
|
|
echo ""
|
|
|
|
# Test 3: Simple GET endpoint
|
|
echo "3️⃣ Testing /say endpoint (saving to test_say.mp3)..."
|
|
curl -s "$BASE_URL/say?text=Hello%20world" -o test_say.mp3
|
|
if [ -f test_say.mp3 ] && [ -s test_say.mp3 ]; then
|
|
echo "✅ Audio saved to test_say.mp3 ($(stat -f%z test_say.mp3 2>/dev/null || stat -c%s test_say.mp3) bytes)"
|
|
else
|
|
echo "❌ Failed to generate audio"
|
|
fi
|
|
echo ""
|
|
|
|
# Test 4: MiniMax-compatible endpoint
|
|
echo "4️⃣ Testing /v1/t2a_v2 endpoint (MiniMax-compatible)..."
|
|
curl -s -X POST "$BASE_URL/v1/t2a_v2" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"text": "Testing MiniMax compatibility",
|
|
"voice_setting": {
|
|
"voice_id": "default",
|
|
"speed": 1.0
|
|
}
|
|
}' | jq '.base_resp, .data.audio_id' || echo "❌ MiniMax endpoint failed"
|
|
echo ""
|
|
|
|
echo "✅ All tests complete!"
|
|
echo ""
|
|
echo "To test audio playback:"
|
|
echo " ffplay test_say.mp3"
|
|
echo " # or"
|
|
echo " mpv test_say.mp3"
|