fix: ignorar teste de endpoint /models do MiniMax
This commit is contained in:
+11
-19
@@ -255,24 +255,16 @@ const testOpenRouter = async (apiKey: string): Promise<TestResult> => {
|
||||
};
|
||||
|
||||
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' };
|
||||
// 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' }
|
||||
]
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user