diff --git a/public/app.js b/public/app.js index d8b53fc..f699112 100644 --- a/public/app.js +++ b/public/app.js @@ -1173,7 +1173,7 @@ const initApp = () => { }; // Função principal de envio de mensagens - const handleSendMessage = async (text, skipUserAppend = false, files = null) => { + const handleSendMessage = async (text, skipUserAppend = false, files = null, forcedIntent = null) => { if (!text && (!files || files.length === 0)) return; // Se não recebe files por parâmetro, usa os anexados globalmente @@ -1282,7 +1282,7 @@ const initApp = () => { headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ messages: messagesPayload }) + body: JSON.stringify({ messages: messagesPayload, forcedIntent: forcedIntent }) }); if (!response.ok) { @@ -1521,6 +1521,39 @@ const initApp = () => { handleSendMessage(text); }); + // Botões de Modos Rápidos de Prompt (Rodapé) + document.querySelectorAll('.btn-prompt-mode').forEach(btn => { + btn.addEventListener('click', () => { + const mode = btn.dataset.mode; + const text = userInput.value.trim(); + + // Se não houver texto digitado, insere um exemplo de prompt baseado na modalidade + if (!text) { + let suggestion = ""; + if (mode === 'AUDIO') { + suggestion = "Crie uma música pedagógica alegre e animada sobre "; + } else if (mode === 'VIDEO') { + suggestion = "Crie um roteiro detalhado para um vídeo educativo sobre "; + } else if (mode === 'IMAGE') { + suggestion = "Crie uma ilustração pedagógica com cores vibrantes mostrando "; + } else if (mode === 'TEXT') { + suggestion = "Escreva uma história educativa infantil curta sobre "; + } + userInput.value = suggestion; + userInput.focus(); + + // Ajustar altura do textarea para acomodar a sugestão + userInput.style.height = 'auto'; + userInput.style.height = userInput.scrollHeight + 'px'; + btnSend.disabled = false; + return; + } + + // Se houver texto, envia imediatamente forçando o modo correspondente + handleSendMessage(text, false, null, mode); + }); + }); + // Sugestões de Prompt Rápidas suggestionCards.forEach(card => { card.addEventListener('click', () => { diff --git a/public/index.html b/public/index.html index 0274d24..ce08dc1 100644 --- a/public/index.html +++ b/public/index.html @@ -179,6 +179,21 @@