/**
 * 测试 MiniMax TTS - 测试 vol 和 pitch 的影响
 */
import axios from 'axios';

const KEY1 = 'sk-cp-s8hGJr4ACdlZ4GM0LjZ1l2ZNBUAMGwd2ahl0c3W2g6C0EiNH0UvwOBx2q0oJOYO6ca5HqJccP_KRUPucoBizavlwDSZp-ohOGeUw2ymAdXPuM6r3CIDmmlY';

async function test() {
  // 测试1: vol=1, pitch=1 (默认值)
  console.log('测试1: vol=1, pitch=1');
  try {
    const resp = await axios.post('https://api.minimaxi.com/v1/t2a_async_v2', {
      model: 'speech-2.8-hd',
      text: '你好',
      voice_setting: { voice_id: 'audiobook_female_1', speed: 1, vol: 1, pitch: 1 },
      audio_setting: { audio_sample_rate: 32000, bitrate: 128000, format: 'mp3', channel: 1 },
    }, {
      headers: { 'Authorization': `Bearer ${KEY1}`, 'Content-Type': 'application/json' },
      timeout: 30000,
    });
    console.log('成功:', JSON.stringify(resp.data));
  } catch (err: any) {
    console.log('失败:', err.response?.data || err.message);
  }

  // 测试2: 完全不传 vol 和 pitch
  console.log('\n测试2: 不传 vol 和 pitch');
  try {
    const resp = await axios.post('https://api.minimaxi.com/v1/t2a_async_v2', {
      model: 'speech-2.8-hd',
      text: '你好',
      voice_setting: { voice_id: 'audiobook_female_1' },
      audio_setting: { audio_sample_rate: 32000, bitrate: 128000, format: 'mp3', channel: 1 },
    }, {
      headers: { 'Authorization': `Bearer ${KEY1}`, 'Content-Type': 'application/json' },
      timeout: 30000,
    });
    console.log('成功:', JSON.stringify(resp.data));
  } catch (err: any) {
    console.log('失败:', err.response?.data || err.message);
  }
}

test();