| <!DOCTYPE html> |
| <html lang="pt-BR"> |
| <head> |
| <meta charset="UTF-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| <title>Chatbot n8n</title> |
| <script src="https://cdn.tailwindcss.com"></script> |
| <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet"> |
| <style> |
| @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap'); |
| |
| body { |
| font-family: 'Inter', sans-serif; |
| background-color: #f0f7f4; |
| } |
| |
| .chat-bubble-user { |
| background-color: #a8d8ea; |
| border-radius: 18px 18px 0 18px; |
| } |
| |
| .chat-bubble-bot { |
| background-color: #e0f0ea; |
| border-radius: 18px 18px 18px 0; |
| } |
| |
| .gradient-bg { |
| background: linear-gradient(135deg, #a8d8ea 0%, #e0f0ea 100%); |
| } |
| |
| .input-focus:focus { |
| box-shadow: 0 0 0 2px #a8d8ea; |
| } |
| |
| .btn-primary { |
| background-color: #5aa897; |
| transition: all 0.3s ease; |
| } |
| |
| .btn-primary:hover { |
| background-color: #478f7e; |
| transform: translateY(-1px); |
| } |
| |
| .pulse-animation { |
| animation: pulse 1.5s infinite; |
| } |
| |
| @keyframes pulse { |
| 0% { opacity: 0.6; } |
| 50% { opacity: 1; } |
| 100% { opacity: 0.6; } |
| } |
| </style> |
| </head> |
| <body class="min-h-screen flex items-center justify-center p-4"> |
| |
| |
| <div id="chat-interface" class="w-full max-w-md bg-white rounded-2xl shadow-xl overflow-hidden flex flex-col" style="height: 600px;"> |
| |
| <div class="gradient-bg p-4 flex items-center justify-between"> |
| <div class="flex items-center space-x-3"> |
| <i class="fas fa-robot text-2xl text-white"></i> |
| <h2 class="text-lg font-semibold text-gray-800">Assistente Virtual</h2> |
| </div> |
| <button id="logout-btn" class="text-gray-700 hover:text-gray-900"> |
| <i class="fas fa-sign-out-alt"></i> |
| </button> |
| </div> |
| |
| |
| <div id="chat-messages" class="flex-1 p-4 overflow-y-auto space-y-3"> |
| |
| <div class="chat-bubble-bot p-3 max-w-xs md:max-w-md"> |
| <p class="text-gray-800">Olá! Sou o assistente virtual integrado ao n8n. Como posso te ajudar hoje?</p> |
| </div> |
| </div> |
| |
| |
| <div class="border-t border-gray-200 p-4 bg-gray-50"> |
| <form id="message-form" class="flex space-x-2"> |
| <input type="text" id="message-input" |
| class="flex-1 px-4 py-2 rounded-full border border-gray-300 focus:input-focus focus:outline-none" |
| placeholder="Digite sua mensagem..." autocomplete="off"> |
| <button type="submit" class="btn-primary w-10 h-10 rounded-full flex items-center justify-center text-white"> |
| <i class="fas fa-paper-plane"></i> |
| </button> |
| </form> |
| </div> |
| </div> |
|
|
| <script> |
| |
| const chatInterface = document.getElementById('chat-interface'); |
| const messageForm = document.getElementById('message-form'); |
| const messageInput = document.getElementById('message-input'); |
| const chatMessages = document.getElementById('chat-messages'); |
| |
| |
| chatInterface.classList.remove('hidden'); |
| |
| |
| messageForm.addEventListener('submit', (e) => { |
| e.preventDefault(); |
| const message = messageInput.value.trim(); |
| |
| if(message) { |
| |
| addUserMessage(message); |
| messageInput.value = ''; |
| |
| |
| const typingIndicator = document.createElement('div'); |
| typingIndicator.className = 'flex space-x-1 items-center p-3'; |
| typingIndicator.id = 'typing-indicator'; |
| typingIndicator.innerHTML = ` |
| <div class="w-2 h-2 rounded-full bg-gray-400 pulse-animation"></div> |
| <div class="w-2 h-2 rounded-full bg-gray-400 pulse-animation" style="animation-delay: 0.2s"></div> |
| <div class="w-2 h-2 rounded-full bg-gray-400 pulse-animation" style="animation-delay: 0.4s"></div> |
| `; |
| chatMessages.appendChild(typingIndicator); |
| chatMessages.scrollTop = chatMessages.scrollHeight; |
| |
| |
| setTimeout(() => { |
| document.getElementById('typing-indicator').remove(); |
| |
| |
| const responses = [ |
| "Entendi sua solicitação. Estou processando as informações...", |
| "Posso te ajudar com automações, integrações ou configurações do n8n. Qual você precisa?", |
| "Para integrar esse chatbot ao n8n, você pode usar o nó HTTP Request em seu workflow.", |
| "Estou verificando os dados solicitados. Um momento por favor.", |
| "Você pode automatizar esse processo criando um workflow no n8n com os nós apropriados." |
| ]; |
| |
| const randomResponse = responses[Math.floor(Math.random() * responses.length)]; |
| addBotMessage(randomResponse); |
| }, 1500); |
| } |
| }); |
| |
| |
| function addUserMessage(message) { |
| const messageDiv = document.createElement('div'); |
| messageDiv.className = 'flex justify-end'; |
| messageDiv.innerHTML = ` |
| <div class="chat-bubble-user p-3 max-w-xs md:max-w-md"> |
| <p class="text-gray-800">${message}</p> |
| </div> |
| `; |
| chatMessages.appendChild(messageDiv); |
| chatMessages.scrollTop = chatMessages.scrollHeight; |
| } |
| |
| function addBotMessage(message) { |
| const messageDiv = document.createElement('div'); |
| messageDiv.className = 'flex justify-start'; |
| messageDiv.innerHTML = ` |
| <div class="chat-bubble-bot p-3 max-w-xs md:max-w-md"> |
| <p class="text-gray-800">${message}</p> |
| </div> |
| `; |
| chatMessages.appendChild(messageDiv); |
| chatMessages.scrollTop = chatMessages.scrollHeight; |
| } |
| |
| |
| messageInput.addEventListener('keydown', (e) => { |
| if(e.key === 'Enter' && !e.shiftKey) { |
| e.preventDefault(); |
| messageForm.dispatchEvent(new Event('submit')); |
| } |
| }); |
| </script> |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=DigiVelo/chatbot" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> |
| </html> |