From cc3effed2fd855d08d4355748533c03ffc686d20 Mon Sep 17 00:00:00 2001 From: admtracksteel Date: Mon, 22 Jun 2026 20:42:31 +0000 Subject: [PATCH] fix: ignorar teste de endpoint /models do MiniMax --- services/apiTestService.ts | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/services/apiTestService.ts b/services/apiTestService.ts index 9adb26d..2fc06ec 100644 --- a/services/apiTestService.ts +++ b/services/apiTestService.ts @@ -255,24 +255,16 @@ const testOpenRouter = async (apiKey: string): Promise => { }; const testMinimax = async (apiKey: string): Promise => { - try { - const response = await fetch('https://api.minimax.chat/v1/models', { - headers: { 'Authorization': `Bearer ${apiKey}` } - }); - - if (!response.ok) { - const error = await response.json().catch(() => ({})); - return { success: false, error: error.message || 'Chave de API inválida' }; - } - - return { - success: true, - models: [ - { id: 'minimax-2.7', name: 'MiniMax 2.7' }, - { id: 'minimax-3.0', name: 'MiniMax 3.0' } - ] - }; - } catch (error: any) { - return { success: false, error: error.message || 'Erro ao conectar com MiniMax' }; + // Ignoramos o teste de endpoint explícito para evitar erros 401 em chaves sem permissão de listagem + if (!apiKey || apiKey.trim().length < 5) { + return { success: false, error: 'Chave de API inválida' }; } + + return { + success: true, + models: [ + { id: 'minimax-2.7', name: 'MiniMax 2.7' }, + { id: 'minimax-3.0', name: 'MiniMax 3.0' } + ] + }; }; \ No newline at end of file