Spaces:
Running
Running
Download index.html from diego1carmo/assistentelegado: direct link, hf CLI and curl.
- Browser
- Download file 49.1 kB
-
https://huggingface.co/spaces/diego1carmo/assistentelegado/resolve/main/index.html
- Command line
-
hf download hf://spaces/diego1carmo/assistentelegado/index.html
-
curl -L -o index.html https://huggingface.co/spaces/diego1carmo/assistentelegado/resolve/main/index.html
49.1 kB
| <html lang="pt-BR"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Criador de Assistentes AI | Gerencie seus Chatbots</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <script> | |
| tailwind.config = { | |
| theme: { | |
| extend: { | |
| colors: { | |
| primary: '#4F46E5', | |
| secondary: '#818CF8', | |
| dark: '#1E293B', | |
| light: '#F8FAFC' | |
| } | |
| } | |
| } | |
| } | |
| </script> | |
| <style> | |
| .card-glow { | |
| box-shadow: 0 4px 20px rgba(79, 70, 229, 0.2); | |
| } | |
| .step-icon { | |
| width: 40px; | |
| height: 40px; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| border-radius: 50%; | |
| background-color: #4F46E5; | |
| color: white; | |
| font-weight: bold; | |
| margin-right: 15px; | |
| } | |
| .tool-item, .rule-item, .assistant-card { | |
| position: relative; | |
| transition: all 0.3s ease; | |
| } | |
| .tool-item:hover, .rule-item:hover, .assistant-card:hover { | |
| transform: translateY(-3px); | |
| box-shadow: 0 6px 15px rgba(0,0,0,0.1); | |
| } | |
| textarea { | |
| resize: vertical; | |
| min-height: 120px; | |
| } | |
| .code-block { | |
| font-family: 'Courier New', monospace; | |
| overflow-x: auto; | |
| } | |
| .slide-down { | |
| animation: slideDown 0.5s forwards; | |
| } | |
| .action-tooltip { | |
| position: absolute; | |
| top: 10px; | |
| right: 10px; | |
| opacity: 0; | |
| transition: all 0.3s ease; | |
| } | |
| .assistant-card:hover .action-tooltip { | |
| opacity: 1; | |
| } | |
| @keyframes slideDown { | |
| from { opacity: 0; transform: translateY(-20px); } | |
| to { opacity: 1; transform: translateY(0); } | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gradient-to-br from-gray-50 to-blue-50 min-h-screen"> | |
| <!-- Header --> | |
| <header class="bg-white shadow-sm"> | |
| <div class="container mx-auto px-4 py-6 flex justify-between items-center"> | |
| <div class="flex items-center"> | |
| <i class="fas fa-robot text-primary text-3xl mr-3"></i> | |
| <h1 class="text-2xl font-bold text-dark">Criador de Assistentes AI</h1> | |
| </div> | |
| <div> | |
| <button id="dashboardBtn" class="bg-primary hover:bg-secondary text-white font-medium py-2 px-4 rounded-lg transition-all"> | |
| <i class="fas fa-tachometer-alt mr-2"></i>Painel de Controle | |
| </button> | |
| </div> | |
| </div> | |
| </header> | |
| <!-- Main Content --> | |
| <main class="container mx-auto px-4 py-8"> | |
| <!-- Dashboard --> | |
| <div id="dashboard"> | |
| <div class="flex justify-between items-center mb-8"> | |
| <div> | |
| <h2 class="text-3xl font-bold text-dark">Meus Assistentes</h2> | |
| <p class="text-gray-600">Gerencie e configure seus assistentes de IA</p> | |
| </div> | |
| <div> | |
| <button id="createNewBtn" class="bg-primary hover:bg-secondary text-white font-medium py-2 px-4 rounded-lg transition-all"> | |
| <i class="fas fa-plus mr-2"></i>Novo Assistente | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Assistant List --> | |
| <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6" id="assistantList"> | |
| <!-- Assistant cards will be added here dynamically --> | |
| <!-- Example Card --> | |
| <div class="assistant-card bg-white rounded-xl shadow-lg p-6 relative"> | |
| <div class="action-tooltip flex gap-2"> | |
| <button class="text-primary hover:text-secondary edit-btn"> | |
| <i class="fas fa-edit"></i> | |
| </button> | |
| <button class="text-red-500 hover:text-red-700 delete-btn"> | |
| <i class="fas fa-trash-alt"></i> | |
| </button> | |
| </div> | |
| <div class="flex items-start mb-4"> | |
| <div class="w-10 h-10 bg-primary rounded-full flex items-center justify-center mr-3"> | |
| <i class="fas fa-robot text-white"></i> | |
| </div> | |
| <div> | |
| <h3 class="font-bold text-xl">Atendente de Vendas</h3> | |
| <p class="text-sm text-gray-600">Status: <span class="text-green-600">Ativo</span></p> | |
| </div> | |
| </div> | |
| <div class="mb-4"> | |
| <p class="text-gray-700">Ajuda clientes a encontrar produtos, responde perguntas sobre preços e recursos, e auxilia no checkout.</p> | |
| </div> | |
| <div class="flex items-center justify-between text-sm"> | |
| <div> | |
| <p><i class="fas fa-tools text-primary mr-1"></i> Ferramentas: 3</p> | |
| <p><i class="fas fa-link text-primary mr-1"></i> Domínios: 2</p> | |
| </div> | |
| <button class="copy-script-btn bg-gray-200 hover:bg-gray-300 text-gray-700 py-1 px-3 rounded"> | |
| <i class="fas fa-code mr-1"></i> Copiar Script | |
| </button> | |
| </div> | |
| </div> | |
| <div class="assistant-card bg-white rounded-xl shadow-lg p-6 relative"> | |
| <div class="action-tooltip flex gap-2"> | |
| <button class="text-primary hover:text-secondary edit-btn"> | |
| <i class="fas fa-edit"></i> | |
| </button> | |
| <button class="text-red-500 hover:text-red-700 delete-btn"> | |
| <i class="fas fa-trash-alt"></i> | |
| </button> | |
| </div> | |
| <div class="flex items-start mb-4"> | |
| <div class="w-10 h-10 bg-purple-600 rounded-full flex items-center justify-center mr-3"> | |
| <i class="fas fa-headset text-white"></i> | |
| </div> | |
| <div> | |
| <h3 class="font-bold text-xl">Suporte Técnico</h3> | |
| <p class="text-sm text-gray-600">Status: <span class="text-gray-600">Pausado</span></p> | |
| </div> | |
| </div> | |
| <div class="mb-4"> | |
| <p class="text-gray-700">Ajuda usuários a resolver problemas técnicos com produtos e serviços da empresa.</p> | |
| </div> | |
| <div class="flex items-center justify-between text-sm"> | |
| <div> | |
| <p><i class="fas fa-tools text-purple-600 mr-1"></i> Ferramentas: 4</p> | |
| <p><i class="fas fa-link text-purple-600 mr-1"></i> Domínios: 1</p> | |
| </div> | |
| <button class="copy-script-btn bg-gray-200 hover:bg-gray-300 text-gray-700 py-1 px-3 rounded"> | |
| <i class="fas fa-code mr-1"></i> Copiar Script | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Form Wizard (hidden initially) --> | |
| <div id="creationForm" class="hidden"> | |
| <div class="text-center mb-12"> | |
| <h2 class="text-4xl font-bold text-dark mb-4" id="formTitle">Criar Novo Assistente</h2> | |
| <p class="text-gray-600 max-w-2xl mx-auto">Crie assistentes de IA personalizados com conhecimento especializado e ações. Incorpore em qualquer lugar com uma única linha de código.</p> | |
| </div> | |
| <!-- Form Wizard --> | |
| <div class="bg-white rounded-xl shadow-lg card-glow overflow-hidden max-w-4xl mx-auto"> | |
| <!-- Progress Bar --> | |
| <div class="h-2 bg-gray-200"> | |
| <div class="h-full bg-primary" id="progressBar" style="width: 0%"></div> | |
| </div> | |
| <!-- Wizard Steps --> | |
| <div class="p-6"> | |
| <!-- Step 1 --> | |
| <div id="step1" class="step-panel"> | |
| <div class="flex items-center mb-6"> | |
| <div class="step-icon">1</div> | |
| <h3 class="text-xl font-semibold text-dark">Detalhes do Assistente</h3> | |
| </div> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6"> | |
| <div> | |
| <label class="block text-gray-700 font-medium mb-2">Nome do Assistente</label> | |
| <input id="assistantName" type="text" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:ring-primary focus:border-primary" placeholder="Ex: Atendente de Vendas"> | |
| </div> | |
| <div> | |
| <label class="block text-gray-700 font-medium mb-2">Função do Assistente</label> | |
| <select id="assistantRole" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:ring-primary focus:border-primary"> | |
| <option>Atendimento ao Cliente</option> | |
| <option>Assistente de Vendas</option> | |
| <option>Suporte Técnico</option> | |
| <option>Assistente de RH</option> | |
| <option>Tutor Educacional</option> | |
| <option selected>Personalizado</option> | |
| </select> | |
| </div> | |
| </div> | |
| <div class="mb-6"> | |
| <label class="block text-gray-700 font-medium mb-2">Ação Primária</label> | |
| <textarea id="assistantAction" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:ring-primary focus:border-primary" placeholder="Descreva o que este assistente deve fazer principalmente. Ex: 'Ajudar clientes a encontrar produtos, responder perguntas sobre preços e funcionalidades, e auxiliar no checkout.'"></textarea> | |
| </div> | |
| <div class="mb-6"> | |
| <label class="block text-gray-700 font-medium mb-2">Base de Conhecimento</label> | |
| <textarea id="knowledgeBase" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:ring-primary focus:border-primary" placeholder="Adicione informações que este assistente deve saber. Inclua FAQs, detalhes do produto, políticas, etc."></textarea> | |
| </div> | |
| <div class="flex justify-end"> | |
| <button class="bg-primary hover:bg-secondary text-white font-medium py-2 px-6 rounded-lg transition-all next-step">Continuar <i class="fas fa-arrow-right ml-2"></i></button> | |
| </div> | |
| </div> | |
| <!-- Step 2 --> | |
| <div id="step2" class="step-panel hidden"> | |
| <div class="flex items-center mb-6"> | |
| <div class="step-icon">2</div> | |
| <h3 class="text-xl font-semibold text-dark">Adicionar Ferramentas</h3> | |
| </div> | |
| <div class="mb-6"> | |
| <label class="block text-gray-700 font-medium mb-4">Ferramentas Disponíveis</label> | |
| <div id="toolsContainer"> | |
| <div class="tool-item bg-light p-5 rounded-lg border border-gray-200 mb-4"> | |
| <div class="flex justify-between mb-3"> | |
| <input type="text" class="w-full bg-transparent text-lg font-medium text-dark outline-none" placeholder="Nome da Ferramenta"> | |
| <button class="text-red-500 hover:text-red-700 tool-remove"> | |
| <i class="fas fa-times"></i> | |
| </button> | |
| </div> | |
| <textarea class="w-full px-3 py-2 rounded-lg bg-white" placeholder="Descrição do que esta ferramenta faz e como o assistente deve usá-la"></textarea> | |
| </div> | |
| </div> | |
| <button id="addToolBtn" class="flex items-center text-primary hover:text-secondary font-medium py-2"> | |
| <i class="fas fa-plus-circle mr-2"></i> Adicionar Ferramenta | |
| </button> | |
| </div> | |
| <div class="flex justify-between"> | |
| <button class="text-primary hover:text-secondary font-medium py-2 px-6 rounded-lg transition-all prev-step"> | |
| <i class="fas fa-arrow-left mr-2"></i> Voltar | |
| </button> | |
| <button class="bg-primary hover:bg-secondary text-white font-medium py-2 px-6 rounded-lg transition-all next-step">Continuar <i class="fas fa-arrow-right ml-2"></i></button> | |
| </div> | |
| </div> | |
| <!-- Step 3 --> | |
| <div id="step3" class="step-panel hidden"> | |
| <div class="flex items-center mb-6"> | |
| <div class="step-icon">3</div> | |
| <h3 class="text-xl font-semibold text-dark">Regras de Domínio</h3> | |
| </div> | |
| <div class="mb-6"> | |
| <p class="text-gray-700 mb-4">Adicione padrões de URL onde ações específicas requerem confirmação do usuário:</p> | |
| <div id="rulesContainer"> | |
| <div class="rule-item bg-light p-5 rounded-lg border border-gray-200 mb-4"> | |
| <div class="flex justify-between mb-3"> | |
| <input type="text" class="w-full bg-transparent text-dark outline-none" placeholder="https://exemplo.com/finalizar-compra/*"> | |
| <button class="text-red-500 hover:text-red-700 rule-remove"> | |
| <i class="fas fa-times"></i> | |
| </button> | |
| </div> | |
| <div class="text-sm text-gray-600">O assistente exigirá confirmação para determinadas ações em URLs que correspondem a este padrão</div> | |
| </div> | |
| </div> | |
| <button id="addRuleBtn" class="flex items-center text-primary hover:text-secondary font-medium py-2"> | |
| <i class="fas fa-plus-circle mr-2"></i> Adicionar Regra | |
| </button> | |
| </div> | |
| <div class="flex justify-between"> | |
| <button class="text-primary hover:text-secondary font-medium py-2 px-6 rounded-lg transition-all prev-step"> | |
| <i class="fas fa-arrow-left mr-2"></i> Voltar | |
| </button> | |
| <button id="saveAssistantBtn" class="bg-primary hover:bg-secondary text-white font-medium py-2 px-6 rounded-lg transition-all">Salvar Assistente</button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Preview Section (hidden initially) --> | |
| <div id="previewSection" class="hidden slide-down bg-white rounded-xl shadow-lg mt-12 p-8 max-w-4xl mx-auto"> | |
| <div class="flex flex-col md:flex-row gap-8"> | |
| <div class="md:w-1/2"> | |
| <h3 class="text-2xl font-bold text-dark mb-6">Seu Assistente de IA está Pronto!</h3> | |
| <div class="mb-6"> | |
| <h4 class="text-lg font-semibold text-dark mb-2">Detalhes do Assistente</h4> | |
| <div class="bg-gray-50 p-4 rounded-lg"> | |
| <div class="flex justify-between mb-2"> | |
| <span class="font-medium">Nome:</span> | |
| <span id="previewName">Atendente de Vendas</span> | |
| </div> | |
| <div class="flex justify-between mb-2"> | |
| <span class="font-medium">Ações:</span> | |
| <span id="previewActions">Ajudar clientes a encontrar produtos, responder perguntas</span> | |
| </div> | |
| <div class="flex justify-between"> | |
| <span class="font-medium">Ferramentas:</span> | |
| <span id="previewTools">3 configuradas</span> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="bg-green-50 border border-green-200 rounded-lg p-4 mb-6"> | |
| <h4 class="text-lg font-semibold text-green-800 mb-2">Script de Incorporação</h4> | |
| <p class="text-green-700 mb-3">Copie este código e adicione ao seu site:</p> | |
| <div id="embedCode" class="code-block bg-gray-800 text-gray-100 p-4 rounded-lg text-sm mb-4"> | |
| <script id="ai-assistant-script" src="https://assistant-platform.com/bot.js?aid=ABC123" async></script> | |
| </div> | |
| <button id="copyScriptBtn" class="w-full bg-green-600 hover:bg-green-700 text-white py-2 px-4 rounded-lg flex items-center justify-center"> | |
| <i class="fas fa-copy mr-2"></i> Copiar Script | |
| </button> | |
| </div> | |
| </div> | |
| <div class="md:w-1/2"> | |
| <div class="bg-dark rounded-lg text-white p-6"> | |
| <h4 class="text-lg font-semibold mb-4">Prévia da Janela de Chat</h4> | |
| <div class="bg-gray-700 rounded-lg p-4 h-96"> | |
| <div class="mb-4 flex"> | |
| <div class="bg-primary w-8 h-8 rounded-full flex items-center justify-center mr-3"> | |
| <i class="fas fa-robot"></i> | |
| </div> | |
| <div class="bg-gray-600 py-2 px-4 rounded-lg w-3/4"> | |
| <p>Olá! Eu sou seu novo assistente de IA. Como posso ajudar você hoje?</p> | |
| </div> | |
| </div> | |
| <div class="mb-4 flex justify-end"> | |
| <div class="bg-secondary py-2 px-4 rounded-lg w-3/4 text-right"> | |
| <p>Você pode me ajudar a encontrar um produto?</p> | |
| </div> | |
| </div> | |
| <div class="flex"> | |
| <div class="bg-primary w-8 h-8 rounded-full flex items-center justify-center mr-3"> | |
| <i class="fas fa-robot"></i> | |
| </div> | |
| <div class="bg-gray-600 py-2 px-4 rounded-lg w-3/4"> | |
| <p>Claro! Posso ajudar você a encontrar produtos, comparar funcionalidades e até mesmo auxiliar no checkout.</p> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="mt-4 flex"> | |
| <input type="text" placeholder="Digite uma mensagem..." class="flex-1 bg-gray-600 text-white py-2 px-4 rounded-l-lg"> | |
| <button class="bg-secondary hover:bg-primary text-white py-2 px-4 rounded-r-lg"> | |
| <i class="fas fa-paper-plane"></i> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="flex justify-center mt-8 gap-4"> | |
| <button id="backToDashboard" class="bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-2 px-6 rounded-lg transition-all"> | |
| <i class="fas fa-tachometer-alt mr-2"></i> Voltar ao Painel | |
| </button> | |
| <button id="newAssistantBtn" class="bg-primary hover:bg-secondary text-white font-medium py-2 px-6 rounded-lg transition-all"> | |
| <i class="fas fa-plus mr-2"></i> Criar Outro Assistente | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </main> | |
| <!-- Footer --> | |
| <footer class="bg-white border-t border-gray-200 mt-12"> | |
| <div class="container mx-auto px-4 py-8"> | |
| <div class="grid grid-cols-1 md:grid-cols-4 gap-8"> | |
| <div> | |
| <h4 class="text-lg font-semibold mb-4">Criador de Assistentes AI</h4> | |
| <p class="text-gray-600">Construa chatbots inteligentes com conhecimento personalizado e ações.</p> | |
| </div> | |
| <div> | |
| <h4 class="text-lg font-semibold mb-4">Recursos</h4> | |
| <ul class="space-y-2"> | |
| <li><a href="#" class="text-gray-600 hover:text-primary">Assistentes Personalizados</a></li> | |
| <li><a href="#" class="text-gray-600 hover:text-primary">Integração de Ferramentas</a></li> | |
| <li><a href="#" class="text-gray-600 hover:text-primary">Incorporar em Qualquer Lugar</a></li> | |
| <li><a href="#" class="text-gray-600 hover:text-primary">Analíticas</a></li> | |
| </ul> | |
| </div> | |
| <div> | |
| <h4 class="text-lg font-semibold mb-4">Ajuda</h4> | |
| <ul class="space-y-2"> | |
| <li><a href="#" class="text-gray-600 hover:text-primary">Documentação</a></li> | |
| <li><a href="#" class="text-gray-600 hover:text-primary">Referência da API</a></li> | |
| <li><a href="#" class="text-gray-600 hover:text-primary">Exemplos</a></li> | |
| <li><a href="#" class="text-gray-600 hover:text-primary">Comunidade</a></li> | |
| </ul> | |
| </div> | |
| <div> | |
| <h4 class="text-lg font-semibold mb-4">Suporte</h4> | |
| <ul class="space-y-2"> | |
| <li><a href="#" class="text-gray-600 hover:text-primary">Central de Ajuda</a></li> | |
| <li><a href="#" class="text-gray-600 hover:text-primary">Contate-nos</a></li> | |
| <li><a href="#" class="text-gray-600 hover:text-primary">Status do Serviço</a></li> | |
| </ul> | |
| </div> | |
| </div> | |
| <div class="border-t border-gray-200 mt-8 pt-6 text-center text-gray-600"> | |
| <p>© 2023 Criador de Assistentes AI. Todos os direitos reservados.</p> | |
| </div> | |
| </div> | |
| </footer> | |
| <script> | |
| // Simulated storage for assistants | |
| let assistants = [ | |
| { | |
| id: 1, | |
| name: "Atendente de Vendas", | |
| role: "Assistente de Vendas", | |
| action: "Ajudar clientes a encontrar produtos, responder perguntas sobre preços e funcionalidades, e auxiliar no checkout.", | |
| tools: ["Pesquisa de Produtos", "Verificador de Estoque", "Sugestor de Itens"], | |
| rules: ["https://exemplo.com/finalizar-compra/*"], | |
| status: "active" | |
| }, | |
| { | |
| id: 2, | |
| name: "Suporte Técnico", | |
| role: "Suporte Técnico", | |
| action: "Ajudar usuários a resolver problemas técnicos com produtos e serviços da empresa.", | |
| tools: ["Solução de Problemas", "Guia de Configuração", "Atualizações de Status", "Agendamento de Suporte"], | |
| rules: ["https://exemplo.com/suporte/*"], | |
| status: "paused" | |
| } | |
| ]; | |
| let currentAssistantId = null; | |
| let isEditing = false; | |
| // Form wizard functionality | |
| document.addEventListener('DOMContentLoaded', function() { | |
| let currentStep = 1; | |
| const progressBar = document.getElementById('progressBar'); | |
| const stepPanels = document.querySelectorAll('.step-panel'); | |
| const previewSection = document.getElementById('previewSection'); | |
| const creationForm = document.getElementById('creationForm'); | |
| const dashboard = document.getElementById('dashboard'); | |
| const assistantList = document.getElementById('assistantList'); | |
| const formTitle = document.getElementById('formTitle'); | |
| // Initial setup - show dashboard | |
| creationForm.classList.add('hidden'); | |
| dashboard.classList.remove('hidden'); | |
| renderAssistantList(); | |
| // Create new assistant button | |
| document.getElementById('createNewBtn').addEventListener('click', function() { | |
| dashboard.classList.add('hidden'); | |
| creationForm.classList.remove('hidden'); | |
| formTitle.textContent = "Criar Novo Assistente"; | |
| resetForm(); | |
| showStep(1); | |
| currentStep = 1; | |
| progressBar.style.width = "0%"; | |
| isEditing = false; | |
| currentAssistantId = null; | |
| }); | |
| // Dashboard button | |
| document.getElementById('dashboardBtn').addEventListener('click', function() { | |
| creationForm.classList.add('hidden'); | |
| previewSection.classList.add('hidden'); | |
| dashboard.classList.remove('hidden'); | |
| }); | |
| // Back to dashboard from preview | |
| document.getElementById('backToDashboard').addEventListener('click', function() { | |
| creationForm.classList.add('hidden'); | |
| previewSection.classList.add('hidden'); | |
| dashboard.classList.remove('hidden'); | |
| }); | |
| // Next step buttons | |
| document.querySelectorAll('.next-step').forEach(button => { | |
| button.addEventListener('click', function(e) { | |
| e.preventDefault(); | |
| if (currentStep < 3) { | |
| // Hide current panel | |
| document.getElementById(`step${currentStep}`).classList.add('hidden'); | |
| // Move to next | |
| currentStep++; | |
| document.getElementById(`step${currentStep}`).classList.remove('hidden'); | |
| // Update progress bar | |
| progressBar.style.width = `${(currentStep - 1) * 33}%`; | |
| } | |
| }); | |
| }); | |
| // Previous step buttons | |
| document.querySelectorAll('.prev-step').forEach(button => { | |
| button.addEventListener('click', function(e) { | |
| e.preventDefault(); | |
| if (currentStep > 1) { | |
| // Hide current panel | |
| document.getElementById(`step${currentStep}`).classList.add('hidden'); | |
| // Move to previous | |
| currentStep--; | |
| document.getElementById(`step${currentStep}`).classList.remove('hidden'); | |
| // Update progress bar | |
| progressBar.style.width = `${(currentStep - 1) * 33}%`; | |
| } | |
| }); | |
| }); | |
| // Save assistant button | |
| document.getElementById('saveAssistantBtn').addEventListener('click', function() { | |
| if (isEditing) { | |
| updateAssistant(); | |
| } else { | |
| createAssistant(); | |
| } | |
| // Hide step 3 | |
| document.getElementById(`step3`).classList.add('hidden'); | |
| // Update preview info | |
| document.getElementById('previewName').textContent = document.getElementById('assistantName').value || "Meu Assistente AI"; | |
| document.getElementById('previewActions').textContent = document.getElementById('assistantAction').value.substring(0, 50) + "..."; | |
| document.getElementById('previewTools').textContent = document.getElementById('toolsContainer').childElementCount + " configuradas"; | |
| // Show preview section | |
| previewSection.classList.remove('hidden'); | |
| previewSection.classList.add('slide-down'); | |
| // Progress bar to full | |
| progressBar.style.width = "100%"; | |
| }); | |
| // Create another assistant button | |
| document.getElementById('newAssistantBtn').addEventListener('click', function() { | |
| previewSection.classList.add('hidden'); | |
| resetForm(); | |
| showStep(1); | |
| currentStep = 1; | |
| progressBar.style.width = "0%"; | |
| formTitle.textContent = "Criar Novo Assistente"; | |
| isEditing = false; | |
| currentAssistantId = null; | |
| }); | |
| // Add tool functionality | |
| document.getElementById('addToolBtn').addEventListener('click', function() { | |
| const toolsContainer = document.getElementById('toolsContainer'); | |
| const newTool = document.createElement('div'); | |
| newTool.className = 'tool-item bg-light p-5 rounded-lg border border-gray-200 mb-4'; | |
| newTool.innerHTML = ` | |
| <div class="flex justify-between mb-3"> | |
| <input type="text" class="w-full bg-transparent text-lg font-medium text-dark outline-none" placeholder="Nome da Ferramenta"> | |
| <button class="text-red-500 hover:text-red-700 tool-remove"> | |
| <i class="fas fa-times"></i> | |
| </button> | |
| </div> | |
| <textarea class="w-full px-3 py-2 rounded-lg bg-white" placeholder="Descrição do que esta ferramenta faz e como o assistente deve usá-la"></textarea> | |
| `; | |
| toolsContainer.appendChild(newTool); | |
| // Add event listener for remove button | |
| newTool.querySelector('.tool-remove').addEventListener('click', function() { | |
| newTool.remove(); | |
| }); | |
| }); | |
| // Add rule functionality | |
| document.getElementById('addRuleBtn').addEventListener('click', function() { | |
| const rulesContainer = document.getElementById('rulesContainer'); | |
| const newRule = document.createElement('div'); | |
| newRule.className = 'rule-item bg-light p-5 rounded-lg border border-gray-200 mb-4'; | |
| newRule.innerHTML = ` | |
| <div class="flex justify-between mb-3"> | |
| <input type="text" class="w-full bg-transparent text-dark outline-none" placeholder="https://exemplo.com/finalizar-compra/*"> | |
| <button class="text-red-500 hover:text-red-700 rule-remove"> | |
| <i class="fas fa-times"></i> | |
| </button> | |
| </div> | |
| <div class="text-sm text-gray-600">O assistente exigirá confirmação para determinadas ações em URLs que correspondem a este padrão</div> | |
| `; | |
| rulesContainer.appendChild(newRule); | |
| // Add event listener for remove button | |
| newRule.querySelector('.rule-remove').addEventListener('click', function() { | |
| newRule.remove(); | |
| }); | |
| }); | |
| // Copy script functionality | |
| document.getElementById('copyScriptBtn').addEventListener('click', function() { | |
| const scriptContent = document.getElementById('embedCode').textContent; | |
| navigator.clipboard.writeText(scriptContent).then(() => { | |
| const button = document.getElementById('copyScriptBtn'); | |
| const originalText = button.innerHTML; | |
| button.innerHTML = '<i class="fas fa-check mr-2"></i> Copiado!'; | |
| setTimeout(() => { | |
| button.innerHTML = originalText; | |
| }, 2000); | |
| }); | |
| }); | |
| // Initialize with remove button events | |
| document.querySelectorAll('.tool-remove').forEach(button => { | |
| button.addEventListener('click', function() { | |
| this.closest('.tool-item').remove(); | |
| }); | |
| }); | |
| document.querySelectorAll('.rule-remove').forEach(button => { | |
| button.addEventListener('click', function() { | |
| this.closest('.rule-item').remove(); | |
| }); | |
| }); | |
| // Function to show a specific step | |
| function showStep(step) { | |
| stepPanels.forEach(panel => panel.classList.add('hidden')); | |
| document.getElementById(`step${step}`).classList.remove('hidden'); | |
| } | |
| // Function to reset form | |
| function resetForm() { | |
| document.getElementById('assistantName').value = ""; | |
| document.getElementById('assistantRole').value = "Personalizado"; | |
| document.getElementById('assistantAction').value = ""; | |
| document.getElementById('knowledgeBase').value = ""; | |
| // Clear tools | |
| const toolsContainer = document.getElementById('toolsContainer'); | |
| while (toolsContainer.firstChild) { | |
| toolsContainer.removeChild(toolsContainer.firstChild); | |
| } | |
| // Add one empty tool | |
| document.getElementById('addToolBtn').click(); | |
| // Clear rules | |
| const rulesContainer = document.getElementById('rulesContainer'); | |
| while (rulesContainer.firstChild) { | |
| rulesContainer.removeChild(rulesContainer.firstChild); | |
| } | |
| // Add one empty rule | |
| document.getElementById('addRuleBtn').click(); | |
| } | |
| // Render assistant list | |
| function renderAssistantList() { | |
| assistantList.innerHTML = ''; | |
| assistants.forEach(assistant => { | |
| const assistantCard = document.createElement('div'); | |
| assistantCard.className = 'assistant-card bg-white rounded-xl shadow-lg p-6 relative'; | |
| let iconClass = "bg-primary"; | |
| if (assistant.status === "paused") iconClass = "bg-gray-500"; | |
| assistantCard.innerHTML = ` | |
| <div class="action-tooltip flex gap-2"> | |
| <button class="text-primary hover:text-secondary edit-btn" data-id="${assistant.id}"> | |
| <i class="fas fa-edit"></i> | |
| </button> | |
| <button class="text-red-500 hover:text-red-700 delete-btn" data-id="${assistant.id}"> | |
| <i class="fas fa-trash-alt"></i> | |
| </button> | |
| </div> | |
| <div class="flex items-start mb-4"> | |
| <div class="w-10 h-10 ${iconClass} rounded-full flex items-center justify-center mr-3"> | |
| <i class="fas fa-robot text-white"></i> | |
| </div> | |
| <div> | |
| <h3 class="font-bold text-xl">${assistant.name}</h3> | |
| <p class="text-sm text-gray-600">Status: | |
| <span class="${assistant.status === 'active' ? 'text-green-600' : 'text-gray-600'}"> | |
| ${assistant.status === 'active' ? 'Ativo' : 'Pausado'} | |
| </span> | |
| </p> | |
| </div> | |
| </div> | |
| <div class="mb-4"> | |
| <p class="text-gray-700">${assistant.action.substring(0, 100)}${assistant.action.length > 100 ? '...' : ''}</p> | |
| </div> | |
| <div class="flex items-center justify-between text-sm"> | |
| <div> | |
| <p><i class="fas fa-tools ${iconClass === 'bg-primary' ? 'text-primary' : 'text-gray-500'} mr-1"></i> Ferramentas: ${assistant.tools.length}</p> | |
| <p><i class="fas fa-link ${iconClass === 'bg-primary' ? 'text-primary' : 'text-gray-500'} mr-1"></i> Domínios: ${assistant.rules.length}</p> | |
| </div> | |
| <button class="copy-script-btn bg-gray-200 hover:bg-gray-300 text-gray-700 py-1 px-3 rounded" data-id="${assistant.id}"> | |
| <i class="fas fa-code mr-1"></i> Copiar Script | |
| </button> | |
| </div> | |
| `; | |
| assistantList.appendChild(assistantCard); | |
| }); | |
| // Add event listeners to the new buttons | |
| document.querySelectorAll('.edit-btn').forEach(btn => { | |
| btn.addEventListener('click', function() { | |
| const assistantId = parseInt(this.getAttribute('data-id')); | |
| editAssistant(assistantId); | |
| }); | |
| }); | |
| document.querySelectorAll('.delete-btn').forEach(btn => { | |
| btn.addEventListener('click', function() { | |
| const assistantId = parseInt(this.getAttribute('data-id')); | |
| deleteAssistant(assistantId); | |
| }); | |
| }); | |
| document.querySelectorAll('.copy-script-btn').forEach(btn => { | |
| btn.addEventListener('click', function() { | |
| const assistantId = parseInt(this.getAttribute('data-id')); | |
| copyAssistantScript(assistantId); | |
| }); | |
| }); | |
| } | |
| // Create a new assistant | |
| function createAssistant() { | |
| // Normally this would be API call | |
| const newAssistant = { | |
| id: assistants.length + 1, | |
| name: document.getElementById('assistantName').value || "Novo Assistente", | |
| role: document.getElementById('assistantRole').value, | |
| action: document.getElementById('assistantAction').value, | |
| tools: [], | |
| rules: [], | |
| status: "active" | |
| }; | |
| // Get tools | |
| document.querySelectorAll('#toolsContainer input[type="text"]').forEach(tool => { | |
| if (tool.value) newAssistant.tools.push(tool.value); | |
| }); | |
| // Get rules | |
| document.querySelectorAll('#rulesContainer input[type="text"]').forEach(rule => { | |
| if (rule.value) newAssistant.rules.push(rule.value); | |
| }); | |
| assistants.push(newAssistant); | |
| renderAssistantList(); | |
| // Show success message | |
| showToast(`Assistente "${newAssistant.name}" criado com sucesso!`, 'success'); | |
| } | |
| // Edit existing assistant | |
| function editAssistant(id) { | |
| const assistant = assistants.find(a => a.id === id); | |
| if (!assistant) return; | |
| isEditing = true; | |
| currentAssistantId = id; | |
| // Populate form | |
| document.getElementById('assistantName').value = assistant.name; | |
| document.getElementById('assistantRole').value = assistant.role; | |
| document.getElementById('assistantAction').value = assistant.action; | |
| // Clear tools and rules | |
| document.getElementById('toolsContainer').innerHTML = ''; | |
| document.getElementById('rulesContainer').innerHTML = ''; | |
| // Add tools | |
| assistant.tools.forEach(tool => { | |
| document.getElementById('addToolBtn').click(); | |
| const tools = document.querySelectorAll('#toolsContainer input[type="text"]'); | |
| tools[tools.length - 1].value = tool; | |
| }); | |
| if (assistant.tools.length === 0) document.getElementById('addToolBtn').click(); | |
| // Add rules | |
| assistant.rules.forEach(rule => { | |
| document.getElementById('addRuleBtn').click(); | |
| const rules = document.querySelectorAll('#rulesContainer input[type="text"]'); | |
| rules[rules.length - 1].value = rule; | |
| }); | |
| if (assistant.rules.length === 0) document.getElementById('addRuleBtn').click(); | |
| // Update form title | |
| formTitle.textContent = `Editar Assistente: ${assistant.name}`; | |
| // Show form | |
| dashboard.classList.add('hidden'); | |
| creationForm.classList.remove('hidden'); | |
| showStep(1); | |
| currentStep = 1; | |
| progressBar.style.width = "0%"; | |
| } | |
| // Update assistant | |
| function updateAssistant() { | |
| const assistant = assistants.find(a => a.id === currentAssistantId); | |
| if (!assistant) return; | |
| // Update values | |
| assistant.name = document.getElementById('assistantName').value || assistant.name; | |
| assistant.role = document.getElementById('assistantRole').value; | |
| assistant.action = document.getElementById('assistantAction').value; | |
| // Update tools | |
| assistant.tools = []; | |
| document.querySelectorAll('#toolsContainer input[type="text"]').forEach(tool => { | |
| if (tool.value) assistant.tools.push(tool.value); | |
| }); | |
| // Update rules | |
| assistant.rules = []; | |
| document.querySelectorAll('#rulesContainer input[type="text"]').forEach(rule => { | |
| if (rule.value) assistant.rules.push(rule.value); | |
| }); | |
| renderAssistantList(); | |
| // Show success message | |
| showToast(`Assistente "${assistant.name}" atualizado com sucesso!`, 'success'); | |
| } | |
| // Delete assistant | |
| function deleteAssistant(id) { | |
| if (!confirm('Tem certeza que deseja excluir este assistente? Essa ação não pode ser desfeita.')) return; | |
| assistants = assistants.filter(a => a.id !== id); | |
| renderAssistantList(); | |
| // If we're editing this assistant, close form | |
| if (currentAssistantId === id) { | |
| creationForm.classList.add('hidden'); | |
| dashboard.classList.remove('hidden'); | |
| } | |
| showToast('Assistente excluído com sucesso!', 'success'); | |
| } | |
| // Copy assistant script | |
| function copyAssistantScript(id) { | |
| const assistant = assistants.find(a => a.id === id); | |
| if (!assistant) return; | |
| const script = `<script id="ai-assistant-script" src="https://assistant-platform.com/bot.js?aid=A${assistant.id}" async></script>`; | |
| navigator.clipboard.writeText(script).then(() => { | |
| showToast('Script copiado para a área de transferência!', 'success'); | |
| }); | |
| } | |
| // Show notification | |
| function showToast(message, type) { | |
| const types = { | |
| 'success': 'bg-green-500', | |
| 'error': 'bg-red-500' | |
| }; | |
| // Remove existing toasts | |
| document.querySelectorAll('.toast').forEach(toast => toast.remove()); | |
| const toast = document.createElement('div'); | |
| toast.className = `toast fixed bottom-6 right-6 text-white px-6 py-4 rounded-lg shadow-lg ${types[type] || 'bg-gray-800'} transition-transform transform -translate-y-2 opacity-0`; | |
| toast.textContent = message; | |
| document.body.appendChild(toast); | |
| // Show toast | |
| setTimeout(() => { | |
| toast.classList.remove('opacity-0'); | |
| toast.classList.remove('-translate-y-2'); | |
| toast.classList.add('opacity-100'); | |
| }, 10); | |
| // Hide after delay | |
| setTimeout(() => { | |
| toast.classList.add('opacity-0'); | |
| toast.classList.add('-translate-y-2'); | |
| // Remove after animation | |
| setTimeout(() => { | |
| toast.remove(); | |
| }, 300); | |
| }, 3000); | |
| } | |
| }); | |
| </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=diego1carmo/assistentelegado" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |