DigiVelo commited on
Commit
eadb2e2
·
verified ·
1 Parent(s): 78c1ce2

retire a tela de login, mantenha somente o chatbot - Initial Deployment

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +177 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Chatbot
3
- emoji: 🦀
4
- colorFrom: purple
5
- colorTo: indigo
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: chatbot
3
+ emoji: 🐳
4
+ colorFrom: blue
5
+ colorTo: green
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,177 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="pt-BR">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Chatbot n8n</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">
9
+ <style>
10
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');
11
+
12
+ body {
13
+ font-family: 'Inter', sans-serif;
14
+ background-color: #f0f7f4;
15
+ }
16
+
17
+ .chat-bubble-user {
18
+ background-color: #a8d8ea;
19
+ border-radius: 18px 18px 0 18px;
20
+ }
21
+
22
+ .chat-bubble-bot {
23
+ background-color: #e0f0ea;
24
+ border-radius: 18px 18px 18px 0;
25
+ }
26
+
27
+ .gradient-bg {
28
+ background: linear-gradient(135deg, #a8d8ea 0%, #e0f0ea 100%);
29
+ }
30
+
31
+ .input-focus:focus {
32
+ box-shadow: 0 0 0 2px #a8d8ea;
33
+ }
34
+
35
+ .btn-primary {
36
+ background-color: #5aa897;
37
+ transition: all 0.3s ease;
38
+ }
39
+
40
+ .btn-primary:hover {
41
+ background-color: #478f7e;
42
+ transform: translateY(-1px);
43
+ }
44
+
45
+ .pulse-animation {
46
+ animation: pulse 1.5s infinite;
47
+ }
48
+
49
+ @keyframes pulse {
50
+ 0% { opacity: 0.6; }
51
+ 50% { opacity: 1; }
52
+ 100% { opacity: 0.6; }
53
+ }
54
+ </style>
55
+ </head>
56
+ <body class="min-h-screen flex items-center justify-center p-4">
57
+
58
+ <!-- Chat Interface (hidden initially) -->
59
+ <div id="chat-interface" class="w-full max-w-md bg-white rounded-2xl shadow-xl overflow-hidden flex flex-col" style="height: 600px;">
60
+ <!-- Chat Header -->
61
+ <div class="gradient-bg p-4 flex items-center justify-between">
62
+ <div class="flex items-center space-x-3">
63
+ <i class="fas fa-robot text-2xl text-white"></i>
64
+ <h2 class="text-lg font-semibold text-gray-800">Assistente Virtual</h2>
65
+ </div>
66
+ <button id="logout-btn" class="text-gray-700 hover:text-gray-900">
67
+ <i class="fas fa-sign-out-alt"></i>
68
+ </button>
69
+ </div>
70
+
71
+ <!-- Chat Messages -->
72
+ <div id="chat-messages" class="flex-1 p-4 overflow-y-auto space-y-3">
73
+ <!-- Messages will be added here dynamically -->
74
+ <div class="chat-bubble-bot p-3 max-w-xs md:max-w-md">
75
+ <p class="text-gray-800">Olá! Sou o assistente virtual integrado ao n8n. Como posso te ajudar hoje?</p>
76
+ </div>
77
+ </div>
78
+
79
+ <!-- Chat Input -->
80
+ <div class="border-t border-gray-200 p-4 bg-gray-50">
81
+ <form id="message-form" class="flex space-x-2">
82
+ <input type="text" id="message-input"
83
+ class="flex-1 px-4 py-2 rounded-full border border-gray-300 focus:input-focus focus:outline-none"
84
+ placeholder="Digite sua mensagem..." autocomplete="off">
85
+ <button type="submit" class="btn-primary w-10 h-10 rounded-full flex items-center justify-center text-white">
86
+ <i class="fas fa-paper-plane"></i>
87
+ </button>
88
+ </form>
89
+ </div>
90
+ </div>
91
+
92
+ <script>
93
+ // DOM Elements
94
+ const chatInterface = document.getElementById('chat-interface');
95
+ const messageForm = document.getElementById('message-form');
96
+ const messageInput = document.getElementById('message-input');
97
+ const chatMessages = document.getElementById('chat-messages');
98
+
99
+ // Show chat interface by default
100
+ chatInterface.classList.remove('hidden');
101
+
102
+ // Message handler
103
+ messageForm.addEventListener('submit', (e) => {
104
+ e.preventDefault();
105
+ const message = messageInput.value.trim();
106
+
107
+ if(message) {
108
+ // Add user message to chat
109
+ addUserMessage(message);
110
+ messageInput.value = '';
111
+
112
+ // Show typing indicator
113
+ const typingIndicator = document.createElement('div');
114
+ typingIndicator.className = 'flex space-x-1 items-center p-3';
115
+ typingIndicator.id = 'typing-indicator';
116
+ typingIndicator.innerHTML = `
117
+ <div class="w-2 h-2 rounded-full bg-gray-400 pulse-animation"></div>
118
+ <div class="w-2 h-2 rounded-full bg-gray-400 pulse-animation" style="animation-delay: 0.2s"></div>
119
+ <div class="w-2 h-2 rounded-full bg-gray-400 pulse-animation" style="animation-delay: 0.4s"></div>
120
+ `;
121
+ chatMessages.appendChild(typingIndicator);
122
+ chatMessages.scrollTop = chatMessages.scrollHeight;
123
+
124
+ // Simulate bot response (replace with actual API call to n8n)
125
+ setTimeout(() => {
126
+ document.getElementById('typing-indicator').remove();
127
+
128
+ // Sample responses - in a real app, this would come from your n8n workflow
129
+ const responses = [
130
+ "Entendi sua solicitação. Estou processando as informações...",
131
+ "Posso te ajudar com automações, integrações ou configurações do n8n. Qual você precisa?",
132
+ "Para integrar esse chatbot ao n8n, você pode usar o nó HTTP Request em seu workflow.",
133
+ "Estou verificando os dados solicitados. Um momento por favor.",
134
+ "Você pode automatizar esse processo criando um workflow no n8n com os nós apropriados."
135
+ ];
136
+
137
+ const randomResponse = responses[Math.floor(Math.random() * responses.length)];
138
+ addBotMessage(randomResponse);
139
+ }, 1500);
140
+ }
141
+ });
142
+
143
+ // Helper functions
144
+ function addUserMessage(message) {
145
+ const messageDiv = document.createElement('div');
146
+ messageDiv.className = 'flex justify-end';
147
+ messageDiv.innerHTML = `
148
+ <div class="chat-bubble-user p-3 max-w-xs md:max-w-md">
149
+ <p class="text-gray-800">${message}</p>
150
+ </div>
151
+ `;
152
+ chatMessages.appendChild(messageDiv);
153
+ chatMessages.scrollTop = chatMessages.scrollHeight;
154
+ }
155
+
156
+ function addBotMessage(message) {
157
+ const messageDiv = document.createElement('div');
158
+ messageDiv.className = 'flex justify-start';
159
+ messageDiv.innerHTML = `
160
+ <div class="chat-bubble-bot p-3 max-w-xs md:max-w-md">
161
+ <p class="text-gray-800">${message}</p>
162
+ </div>
163
+ `;
164
+ chatMessages.appendChild(messageDiv);
165
+ chatMessages.scrollTop = chatMessages.scrollHeight;
166
+ }
167
+
168
+ // Allow sending message with Enter key (but allow Shift+Enter for new lines)
169
+ messageInput.addEventListener('keydown', (e) => {
170
+ if(e.key === 'Enter' && !e.shiftKey) {
171
+ e.preventDefault();
172
+ messageForm.dispatchEvent(new Event('submit'));
173
+ }
174
+ });
175
+ </script>
176
+ <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>
177
+ </html>