This repository has been archived on 2026-08-19. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
2026-08-20 00:45:43 +02:00

28 lines
979 B
Python

#!/usr/bin/env python3
"""Debug proxy_tts 400 error"""
import sys, traceback
sys.path.insert(0, "/opt/dashboard")
# Read app source
src = open("/opt/dashboard/app.py").read()
idx = src.find("app.run(")
exec(compile(src[:idx], "app.py", "exec"))
# Use Flask test client
with app.test_client() as c:
print("=== Test 1: POST with JSON ===")
r = c.post("/api/proxy/tts", json={"input":"Hello test","voice":"vivian","language":"en","speed":1.0})
print(f"Status: {r.status_code}")
if r.status_code != 200:
print(f"Body: {r.data[:500]}")
else:
print(f"Content-Type: {r.content_type}, Size: {len(r.data)}")
print("\n=== Test 2: POST with raw JSON string ===")
r = c.post("/api/proxy/tts", data='{"input":"Hello"}', content_type="application/json")
print(f"Status: {r.status_code}")
if r.status_code != 200:
print(f"Body: {r.data[:500]}")
else:
print(f"Content-Type: {r.content_type}, Size: {len(r.data)}")