fix(audit): aumentando timeouts de fetch para 10 minutos para suportar modelos de raciocínio profundo

This commit is contained in:
2026-07-11 22:30:36 +00:00
parent 325143fe21
commit bf485b16ae
+5 -5
View File
@@ -68,7 +68,7 @@ async function callOpenAI(
'Authorization': `Bearer ${config.apiKey}`, 'Authorization': `Bearer ${config.apiKey}`,
}, },
body: JSON.stringify(body), body: JSON.stringify(body),
}, 180000, signal); }, 600000, signal);
const data = await response.json() as { choices?: { message?: { content?: string } }[]; error?: { message?: string } }; const data = await response.json() as { choices?: { message?: { content?: string } }[]; error?: { message?: string } };
if (data.error) throw new Error(`OpenAI error: ${data.error.message}`); if (data.error) throw new Error(`OpenAI error: ${data.error.message}`);
const content = data.choices?.[0]?.message?.content; const content = data.choices?.[0]?.message?.content;
@@ -103,7 +103,7 @@ async function callAnthropic(
'anthropic-dangerous-direct-browser-access': 'true', 'anthropic-dangerous-direct-browser-access': 'true',
}, },
body: JSON.stringify(body), body: JSON.stringify(body),
}, 180000, signal); }, 600000, signal);
const data = await response.json() as { content?: { text?: string }[]; error?: { type?: string; message?: string } }; const data = await response.json() as { content?: { text?: string }[]; error?: { type?: string; message?: string } };
if (data.error) throw new Error(`Anthropic error: ${data.error.message}`); if (data.error) throw new Error(`Anthropic error: ${data.error.message}`);
const text = data.content?.[0]?.text; const text = data.content?.[0]?.text;
@@ -136,7 +136,7 @@ async function callMinimax(
'Authorization': `Bearer ${config.apiKey}`, 'Authorization': `Bearer ${config.apiKey}`,
}, },
body: JSON.stringify(body), body: JSON.stringify(body),
}, 180000, signal); }, 600000, signal);
const data = await response.json() as { choices?: { message?: { content?: string } }[]; error?: { message?: string } }; const data = await response.json() as { choices?: { message?: { content?: string } }[]; error?: { message?: string } };
if (data.error) throw new Error(`MiniMax error: ${data.error.message}`); if (data.error) throw new Error(`MiniMax error: ${data.error.message}`);
const content = data.choices?.[0]?.message?.content; const content = data.choices?.[0]?.message?.content;
@@ -170,7 +170,7 @@ async function callOpenRouter(
'X-Title': 'BrainWind NBR 6123', 'X-Title': 'BrainWind NBR 6123',
}, },
body: JSON.stringify(body), body: JSON.stringify(body),
}, 180000, signal); }, 600000, signal);
if (!response.ok) { if (!response.ok) {
const errText = await response.text(); const errText = await response.text();
throw new Error(`OpenRouter HTTP ${response.status}: ${errText}`); throw new Error(`OpenRouter HTTP ${response.status}: ${errText}`);
@@ -205,7 +205,7 @@ async function callOllama(
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body), body: JSON.stringify(body),
}, 300000, signal); }, 600000, signal);
const data = await response.json() as { message?: { content?: string }; error?: string }; const data = await response.json() as { message?: { content?: string }; error?: string };
if (data.error) throw new Error(`Ollama error: ${data.error}`); if (data.error) throw new Error(`Ollama error: ${data.error}`);
if (!data.message?.content) throw new Error('Ollama returned empty response'); if (!data.message?.content) throw new Error('Ollama returned empty response');