feat: adicionar suporte a modelos MiniMax (2.7 e 3.0)
This commit is contained in:
@@ -28,6 +28,8 @@ export const testApiKey = async (provider: AIProvider, apiKey: string, endpoint?
|
||||
return await testOllama(endpoint);
|
||||
case 'openrouter':
|
||||
return await testOpenRouter(apiKey);
|
||||
case 'minimax':
|
||||
return await testMinimax(apiKey);
|
||||
default:
|
||||
return { success: false, error: 'Provedor não suportado' };
|
||||
}
|
||||
@@ -250,4 +252,27 @@ const testOpenRouter = async (apiKey: string): Promise<TestResult> => {
|
||||
} catch (error: any) {
|
||||
return { success: false, error: error.message || 'Erro ao conectar com OpenRouter' };
|
||||
}
|
||||
};
|
||||
|
||||
const testMinimax = async (apiKey: string): Promise<TestResult> => {
|
||||
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' };
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user