const axios = require('axios');

async function testAI() {
  try {
    console.log('🧪 测试 AI 接口...');
    
    const response = await axios.post('https://api.minimaxi.chat/v1/text/chatcompletion_v2', {
      model: 'MiniMax-M2.7',
      messages: [
        { role: 'user', content: '你好，请回复OK' }
      ],
      max_tokens: 10
    }, {
      headers: {
        'Authorization': `Bearer ${process.env.MINIMAX_API_KEY}`,
        'Content-Type': 'application/json'
      },
      timeout: 30000
    });

    console.log('✅ AI 接口正常');
    console.log('响应:', response.data.choices?.[0]?.message?.content);
  } catch (error) {
    console.error('❌ AI 接口失败:');
    console.error('状态码:', error.response?.status);
    console.error('错误信息:', error.response?.data || error.message);
  }
}

testAI();
