quick_test2.py 509 B

123456789101112131415
  1. import requests, json
  2. # 用统一的 voice_01 测试
  3. r = requests.post('http://localhost:3000/api/tts/generate', json={
  4. 'text': '春天来了万物复苏阳光温暖地洒在大地上',
  5. 'voiceId': 'voice_01',
  6. 'ttsProvider': 'bailian'
  7. })
  8. d = r.json()
  9. print(f'code={d.get("code")} msg={d.get("message")}')
  10. if d.get('data'):
  11. print(f'audioId={d["data"].get("audioId")}')
  12. print(f'audioUrl={d["data"].get("audioUrl","")[:80]}')
  13. else:
  14. print(f'err={json.dumps(d, ensure_ascii=False)[:300]}')