Fix: mostra o erro da API MiniMax na UI e no chat para facilitar o debug da geração de imagens
This commit is contained in:
@@ -2069,6 +2069,20 @@ const initApp = () => {
|
|||||||
`;
|
`;
|
||||||
botContentDiv.innerHTML = assistantContent;
|
botContentDiv.innerHTML = assistantContent;
|
||||||
scrollToBottom();
|
scrollToBottom();
|
||||||
|
} else if (parsed.type === 'error') {
|
||||||
|
isMediaResponse = true;
|
||||||
|
if (progressTimer) {
|
||||||
|
clearInterval(progressTimer);
|
||||||
|
progressTimer = null;
|
||||||
|
}
|
||||||
|
botContentDiv.innerHTML = `
|
||||||
|
<div class="message-row bot">
|
||||||
|
<div class="message-content">
|
||||||
|
<p style="color: red; font-weight: bold;">⚠️ Erro na geração: ${escapeHtml(parsed.message)}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
scrollToBottom();
|
||||||
} else if (parsed.type === 'audio') {
|
} else if (parsed.type === 'audio') {
|
||||||
isMediaResponse = true;
|
isMediaResponse = true;
|
||||||
if (progressTimer) {
|
if (progressTimer) {
|
||||||
|
|||||||
@@ -461,7 +461,8 @@ app.post('/api/comics/generate-frame', requireAuth, async (req, res) => {
|
|||||||
const genData = await genResp.json();
|
const genData = await genResp.json();
|
||||||
const imageUrl = genData.data?.image_urls?.[0];
|
const imageUrl = genData.data?.image_urls?.[0];
|
||||||
if (!imageUrl) {
|
if (!imageUrl) {
|
||||||
throw new Error('Nenhuma URL de imagem retornada pela MiniMax.');
|
const msg = genData.base_resp?.status_msg || 'desconhecido';
|
||||||
|
throw new Error(`Nenhuma URL de imagem. Status MiniMax: ${msg}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Baixar e salvar localmente
|
// Baixar e salvar localmente
|
||||||
@@ -3468,7 +3469,8 @@ app.post('/api/chat', requireAuth, async (req, res) => {
|
|||||||
const genData = await genResp.json();
|
const genData = await genResp.json();
|
||||||
const imageUrl = genData.data?.image_urls?.[0];
|
const imageUrl = genData.data?.image_urls?.[0];
|
||||||
if (!imageUrl) {
|
if (!imageUrl) {
|
||||||
throw new Error('Nenhuma URL de imagem retornada pela MiniMax');
|
const msg = genData.base_resp?.status_msg || 'desconhecido';
|
||||||
|
throw new Error(`Nenhuma URL de imagem. Status MiniMax: ${msg}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2) Baixar e salvar localmente no servidor (a URL expira em pouco tempo)
|
// 2) Baixar e salvar localmente no servidor (a URL expira em pouco tempo)
|
||||||
|
|||||||
Reference in New Issue
Block a user