fix: resolve erro PayloadTooLarge ao salvar midias localmente e integra veo-3.1-lite para video
This commit is contained in:
+9
-2
@@ -1273,8 +1273,15 @@ const initApp = () => {
|
||||
let assistantContent = '';
|
||||
|
||||
try {
|
||||
// Filtrar mensagens para enviar apenas o histórico necessário ao OpenRouter
|
||||
const messagesPayload = chat.messages.map(m => ({ role: m.role, content: m.content }));
|
||||
// Filtrar mensagens para enviar apenas o histórico necessário ao OpenRouter, removendo dados base64 pesados de mídias
|
||||
const messagesPayload = chat.messages.map(m => {
|
||||
let cleanContent = m.content || '';
|
||||
if (cleanContent.includes('data:image/') || cleanContent.includes('data:audio/') || cleanContent.includes('data:video/')) {
|
||||
const typeLabel = cleanContent.includes('custom-audio-player') ? 'Áudio/Música' : (cleanContent.includes('media-video-container') ? 'Vídeo' : 'Imagem');
|
||||
cleanContent = `[Mídia gerada anteriormente: ${typeLabel}]`;
|
||||
}
|
||||
return { role: m.role, content: cleanContent };
|
||||
});
|
||||
|
||||
// Fazer a chamada HTTP usando stream
|
||||
const response = await fetch('/api/chat', {
|
||||
|
||||
Reference in New Issue
Block a user