FourLabs-UN2 commited on
Commit
db5e308
·
verified ·
1 Parent(s): ae0de22

Faça com que ao apertar o botão de Enviar PDF abra um modal para enviar o arquivo pdf

Browse files
Files changed (2) hide show
  1. README.md +9 -5
  2. index.html +550 -19
README.md CHANGED
@@ -1,10 +1,14 @@
1
  ---
2
- title: Pdf Chat Wizard Pro
3
- emoji: 😻
4
- colorFrom: yellow
5
- colorTo: red
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: PDF Chat Wizard Pro 🧙‍♂️
3
+ colorFrom: green
4
+ colorTo: pink
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://deepsite.hf.co).
14
+
index.html CHANGED
@@ -1,19 +1,550 @@
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
+
2
+
3
+
4
+
5
+
6
+ <!DOCTYPE html>
7
+ <html lang="en">
8
+ <head>
9
+ <meta charset="UTF-8">
10
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
11
+ <title>Mr. Mxyzptlk - Converse com um Modelo | Fourlabs</title>
12
+ <script src="https://cdn.tailwindcss.com"></script>
13
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
14
+ <link rel="icon" type="image/x-icon" href="/static/imgs/icon.svg">
15
+ <link rel="stylesheet" href="/static/style/dashboard.css">
16
+ <script src="https://unpkg.com/feather-icons"></script>
17
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
18
+ <script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.net.min.js"></script>
19
+ <script>
20
+ tailwind.config = {
21
+ theme: {
22
+ extend: {
23
+ colors: {
24
+ primary: '#21223a',
25
+ secondary: '#ff580f',
26
+ }
27
+ }
28
+ }
29
+ }
30
+ </script>
31
+ </head>
32
+ <body class="bg-gray-100">
33
+ <div class="flex h-screen overflow-hidden">
34
+ <!-- Sidebar -->
35
+ <div class="sidebar bg-primary text-white w-64 md:w-20 lg:w-64 fixed h-full overflow-y-auto">
36
+ <div class="p-4 border-b border-gray-700">
37
+ <div class="w-full flex flex-col items-center justify-center">
38
+ <img
39
+ alt="logo"
40
+ loading="lazy"
41
+ width="100"
42
+ height="100"
43
+ decoding="async"
44
+ data-nimg="1"
45
+ class="w-36"
46
+ src="/static/imgs/logo-branco-labs.svg"
47
+ style="color: transparent;margin-top: 8px;"
48
+ >
49
+ <p
50
+ class="text-[10px] text-white mt-2 text-center"
51
+ style="margin-top: -1px; margin-left: 12px;font-size: 9px;">
52
+ Inovação e experimentação
53
+ </p>
54
+ </div>
55
+ </div>
56
+
57
+ <div class="p-4">
58
+ <div class="flex items-center space-x-3 mb-6">
59
+ <div class="w-10 h-10 rounded-full bg-secondary flex items-center justify-center">
60
+ <span class="font-bold">MS</span>
61
+ </div>
62
+ <div class="lg:block hidden">
63
+ <h3 class="font-semibold">Marlon Sousa</h3>
64
+ <p class="text-xs text-gray-400">Admin</p>
65
+ </div>
66
+ </div>
67
+
68
+ <nav>
69
+ <ul class="space-y-2">
70
+ <li>
71
+ <a href="/"
72
+ class="sidebar-item flex items-center p-3 rounded-lg
73
+ ">
74
+ <i class="fa-solid fa-server text-secondary w-6 text-center"></i>
75
+ <span class="ml-3 lg:block hidden">Instances</span>
76
+ </a>
77
+ </li>
78
+ <li>
79
+ <a href="/chat/"
80
+ class="sidebar-item flex items-center p-3 rounded-lg
81
+ active">
82
+ <i class="fa-solid fa-comment text-secondary w-6 text-center"></i>
83
+ <span class="ml-3 lg:block hidden">Chat Model</span>
84
+ </a>
85
+ </li>
86
+ <li>
87
+ <a href="/"
88
+ class="sidebar-item flex items-center p-3 rounded-lg
89
+ ">
90
+ <i data-feather="activity" class="text-secondary w-5 h-5 mr-3"></i>
91
+ <span class="ml-3 lg:block hidden">Monitoring</span>
92
+ </a>
93
+ </li>
94
+ <li>
95
+ <a href="/settings/"
96
+ class="sidebar-item flex items-center p-3 rounded-lg
97
+ ">
98
+ <i class="fa-solid fa-screwdriver-wrench text-secondary w-6 text-center"></i>
99
+ <span class="ml-3 lg:block hidden">Configurações</span>
100
+ </a>
101
+ </li>
102
+ </ul>
103
+ </nav>
104
+ </div>
105
+
106
+ <div class="p-4 border-t border-gray-700">
107
+ <h3 class="text-sm font-medium mb-2 lg:block hidden">Documentos Recentes</h3>
108
+ <div class="agent-history">
109
+ <ul id="agent-history">
110
+
111
+ </ul>
112
+ </div>
113
+ </div>
114
+
115
+ <div class="absolute bottom-0 w-full p-4 border-t border-gray-700">
116
+ <form id="logout-form" method="POST" action="/account/logout/" class="hidden">
117
+ <input type="hidden" name="csrfmiddlewaretoken" value="pyj7mp4hVdjHNtFct0e7FSPl52GkVOZ49v0zPK4KMopkFIIlDfM67bXNsPnJh759">
118
+ </form>
119
+
120
+ <a href="#" onclick="document.getElementById('logout-form').submit(); return false;" class="sidebar-item flex items-center p-3 rounded-lg">
121
+ <i class="fas fa-sign-out-alt text-secondary w-6 text-center"></i>
122
+ <span class="ml-3 lg:block hidden">Logout</span>
123
+ </a>
124
+ </div>
125
+ </div>
126
+
127
+ <!-- Main Content -->
128
+ <div class="flex-1 ml-0 md:ml-20 lg:ml-64 overflow-y-auto">
129
+ <!-- Top Navigation -->
130
+ <header class="bg-white shadow-sm">
131
+ <div class="flex items-center justify-between p-4">
132
+ <div class="flex items-center space-x-4">
133
+ <button id="mobileToggleSidebar" class="text-gray-600 lg:hidden block">
134
+ <i class="fas fa-bars text-xl"></i>
135
+ </button>
136
+ <h1 class="text-xl font-bold text-primary">Converse com um Modelo</h1>
137
+ </div>
138
+ <div class="flex items-center space-x-4">
139
+ <a href="/launch/" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-primary hover:bg-primary-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
140
+ <i data-feather="plus" class="mr-2 w-4 h-4"></i>
141
+ Launch New Instance
142
+ </a>
143
+ <div class="relative">
144
+ <button id="notificationsBtn" class="relative">
145
+ <i class="fas fa-bell text-xl text-gray-600"></i>
146
+ <span class="absolute -top-1 -right-1 bg-secondary text-white text-xs rounded-full h-4 w-4 flex items-center justify-center">0</span>
147
+ </button>
148
+ <div id="notificationsDropdown" class="hidden absolute right-0 mt-2 w-80 bg-white rounded-md shadow-lg overflow-hidden z-50">
149
+ <div class="py-1">
150
+ <div class="px-4 py-2 border-b border-gray-200">
151
+ <h3 class="text-sm font-medium text-gray-700">Notifications</h3>
152
+ </div>
153
+
154
+ </div>
155
+ <div class="px-4 py-2 bg-gray-50 text-center">
156
+ <a href="#" class="text-sm font-medium text-secondary hover:text-primary">View all notifications</a>
157
+ </div>
158
+ </div>
159
+ </div>
160
+ </div>
161
+ </div>
162
+ </header>
163
+
164
+ <!-- Dashboard Content -->
165
+
166
+
167
+ <style>
168
+ :root {
169
+ --primary: #21223a;
170
+ --secondary: #ff580f;
171
+ }
172
+
173
+ .chat-container {
174
+ scroll-behavior: smooth;
175
+ height: calc(100% - 28%);
176
+ overflow-y: auto;
177
+ }
178
+
179
+ .message-bubble {
180
+ max-width: 80%;
181
+ animation: fadeIn 0.3s ease-in;
182
+ }
183
+
184
+ .typing-indicator {
185
+ display: inline-flex;
186
+ align-items: center;
187
+ gap: 4px;
188
+ }
189
+
190
+ .typing-dot {
191
+ width: 6px;
192
+ height: 6px;
193
+ background-color: var(--secondary);
194
+ border-radius: 50%;
195
+ animation: typing 1.4s infinite ease-in-out;
196
+ }
197
+
198
+ .typing-dot:nth-child(2) { animation-delay: 0.16s; }
199
+ .typing-dot:nth-child(3) { animation-delay: 0.32s; }
200
+
201
+ @keyframes typing {
202
+ 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
203
+ 30% { transform: translateY(-10px); opacity: 1; }
204
+ }
205
+
206
+ @keyframes fadeIn {
207
+ from { opacity: 0; transform: translateY(10px); }
208
+ to { opacity: 1; transform: translateY(0); }
209
+ }
210
+
211
+ .llm-option:hover {
212
+ transform: translateY(-2px);
213
+ box-shadow: 0 8px 25px rgba(33, 34, 58, 0.15);
214
+ }
215
+ </style>
216
+
217
+ <div class="bg-gray-50 border-b border-gray-200 p-3">
218
+ <div class="flex items-center justify-between">
219
+ <div class="flex items-center space-x-3">
220
+ <span class="text-sm text-gray-600">Modelo:</span>
221
+ <select class="text-sm border border-gray-300 rounded-md px-3 py-1 focus:outline-none focus:ring-1 focus:ring-[#ff580f]">
222
+ <option value="gpt-4" selected>GPT-4</option>
223
+ <option value="claude-2">Claude 2</option>
224
+ <option value="llama-2">Llama 2</option>
225
+ <option value="mistral-7b">Mistral 7B</option>
226
+ </select>
227
+ </div>
228
+ <button
229
+ id="uploadPdfBtn"
230
+ class="inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[#ff580f]"
231
+ >
232
+ <i data-feather="upload" class="mr-2 w-4 h-4"></i>
233
+ Enviar PDF
234
+ </button>
235
+ </div>
236
+ </div>
237
+
238
+
239
+ <!-- Chat Messages -->
240
+ <div class="flex-1 p-6 space-y-6 chat-container overflow-y-auto" id="chatMessages">
241
+ <div class="message-bubble bg-white rounded-2xl p-4 shadow-md ml-auto">
242
+ <p class="text-gray-800">Olá! Como posso ajudar você hoje?</p>
243
+ <span class="text-xs text-gray-500 block mt-2">12:30 PM</span>
244
+ </div>
245
+
246
+ <div class="message-bubble bg-[#21223a] text-white rounded-2xl p-4 shadow-md">
247
+ <p>Estou aqui para assistir você! Posso responder perguntas, ajudar com pesquisas, escrever conteúdo e muito mais. O que você gostaria de fazer?</p>
248
+ <span class="text-xs text-gray-300 block mt-2">12:31 PM</span>
249
+ </div>
250
+ </div>
251
+
252
+ <!-- Input Area -->
253
+ <div class="bg-white border-t border-gray-200 p-6">
254
+ <div class="flex items-center space-x-4">
255
+ <div class="flex-1 relative">
256
+ <input
257
+ type="text"
258
+ placeholder="Digite sua mensagem..."
259
+ class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#ff580f] focus:border-transparent"
260
+ id="messageInput"
261
+ >
262
+ <div class="absolute right-3 top-3 flex items-center space-x-2">
263
+ <button class="text-gray-400 hover:text-[#ff580f] transition-colors">
264
+ <i data-feather="paperclip"></i>
265
+ </button>
266
+ <button class="text-gray-400 hover:text-[#ff580f] transition-colors">
267
+ <i data-feather="mic"></i>
268
+ </button>
269
+ </div>
270
+ </div>
271
+ <button
272
+ class="bg-[#ff580f] hover:bg-[#e64a0c] text-white p-3 rounded-lg transition-colors duration-200"
273
+ onclick="sendMessage()"
274
+ >
275
+ <i data-feather="send"></i>
276
+ </button>
277
+ </div>
278
+
279
+ <div class="mt-3 flex items-center justify-end">
280
+ <span class="text-sm text-gray-500">⌘K para atalhos</span>
281
+ </div>
282
+ </div>
283
+ <!-- PDF Upload Modal -->
284
+ <div id="pdfUploadModal" class="hidden fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full z-50">
285
+ <div class="relative top-20 mx-auto p-5 border w-96 shadow-lg rounded-md bg-white">
286
+ <div class="mt-3 text-center">
287
+ <div class="mx-auto flex items-center justify-center h-12 w-12 rounded-full bg-[#ff580f]">
288
+ <i data-feather="file-text" class="text-white"></i>
289
+ </div>
290
+ <h3 class="text-lg leading-6 font-medium text-gray-900 mt-2">
291
+ Enviar PDF
292
+ </h3>
293
+ <div class="mt-2 px-7 py-3">
294
+ <p class="text-sm text-gray-500">
295
+ Selecione um arquivo PDF para enviar e processar.
296
+ </p>
297
+ <form class="mt-4">
298
+ <div class="flex items-center justify-center w-full">
299
+ <label for="pdfFile" class="flex flex-col items-center justify-center w-full h-32 border-2 border-gray-300 border-dashed rounded-lg cursor-pointer bg-gray-50 hover:bg-gray-100">
300
+ <div class="flex flex-col items-center justify-center pt-5 pb-6">
301
+ <i data-feather="upload-cloud" class="w-8 h-8 text-gray-400"></i>
302
+ <p class="mb-2 text-sm text-gray-500"><span class="font-semibold">Clique para enviar</span> ou arraste e solte</p>
303
+ <p class="text-xs text-gray-500">PDF (MAX. 10MB)</p>
304
+ </div>
305
+ <input id="pdfFile" name="pdfFile" type="file" class="hidden" accept=".pdf">
306
+ </label>
307
+ </div>
308
+ </form>
309
+ <div class="items-center px-4 py-3 mt-4">
310
+ <button
311
+ id="uploadSubmitBtn"
312
+ class="px-4 py-2 bg-[#ff580f] text-white text-base font-medium rounded-md w-full shadow-sm hover:bg-[#e64a0c] focus:outline-none focus:ring-2 focus:ring-[#ff580f]">
313
+ Enviar PDF
314
+ </button>
315
+ <button
316
+ id="uploadCancelBtn"
317
+ class="mt-3 px-4 py-2 bg-gray-300 text-gray-700 text-base font-medium rounded-md w-full shadow-sm hover:bg-gray-400 focus:outline-none focus:ring-2 focus:ring-gray-500">
318
+ Cancelar
319
+ </button>
320
+ </div>
321
+ </div>
322
+ </div>
323
+ </div>
324
+
325
+ <script>
326
+ feather.replace();
327
+
328
+ // PDF Upload Modal Functionality
329
+ const uploadPdfBtn = document.getElementById('uploadPdfBtn');
330
+ const pdfUploadModal = document.getElementById('pdfUploadModal');
331
+ const uploadCancelBtn = document.getElementById('uploadCancelBtn');
332
+ const uploadSubmitBtn = document.getElementById('uploadSubmitBtn');
333
+ const pdfFileInput = document.getElementById('pdfFile');
334
+
335
+ uploadPdfBtn.addEventListener('click', function() {
336
+ pdfUploadModal.classList.remove('hidden');
337
+ });
338
+
339
+ uploadCancelBtn.addEventListener('click', function() {
340
+ pdfUploadModal.classList.add('hidden');
341
+ pdfFileInput.value = '';
342
+ });
343
+
344
+ uploadSubmitBtn.addEventListener('click', function() {
345
+ const file = pdfFileInput.files[0];
346
+ if (!file) {
347
+ alert('Por favor, selecione um arquivo PDF.');
348
+ return;
349
+ }
350
+
351
+ if (file.type !== 'application/pdf') {
352
+ alert('Por favor, selecione apenas arquivos PDF.');
353
+ return;
354
+ }
355
+
356
+ if (file.size > 10 * 1024 * 1024) {
357
+ alert('O arquivo é muito grande. Tamanho máximo: 10MB.');
358
+ return;
359
+ }
360
+
361
+ // Simulate file upload
362
+ addMessage(`PDF enviado: ${file.name}`, 'user');
363
+ addMessage(`Estou processando o arquivo "${file.name}". Em breve poderei responder perguntas sobre seu conteúdo.`, 'ai');
364
+
365
+ pdfUploadModal.classList.add('hidden');
366
+ pdfFileInput.value = '';
367
+ });
368
+
369
+ // Close modal when clicking outside
370
+ pdfUploadModal.addEventListener('click', function(e) {
371
+ if (e.target === pdfUploadModal) {
372
+ pdfUploadModal.classList.add('hidden');
373
+ pdfFileInput.value = '';
374
+ }
375
+ });
376
+ const chatMessages = document.getElementById('chatMessages');
377
+ const messageInput = document.getElementById('messageInput');
378
+
379
+ function sendMessage() {
380
+ const message = messageInput.value.trim();
381
+ if (!message) return;
382
+
383
+ // Add user message
384
+ addMessage(message, 'user');
385
+ messageInput.value = '';
386
+
387
+ // Simulate AI response
388
+ setTimeout(() => {
389
+ addTypingIndicator();
390
+
391
+ setTimeout(() => {
392
+ removeTypingIndicator();
393
+ addMessage(getAIResponse(message), 'ai');
394
+ }, 2000);
395
+ }, 500);
396
+ }
397
+
398
+ function addMessage(text, sender) {
399
+ const messageDiv = document.createElement('div');
400
+ messageDiv.className = `message-bubble ${sender === 'user' ? 'bg-white rounded-2xl p-4 shadow-md ml-auto' : 'bg-[#21223a] text-white rounded-2xl p-4 shadow-md'}`;
401
+
402
+ const messageContent = document.createElement('p');
403
+ messageContent.className = sender === 'user' ? 'text-gray-800' : 'text-white';
404
+ messageContent.textContent = text;
405
+
406
+ const timestamp = document.createElement('span');
407
+ timestamp.className = `text-xs block mt-2 ${sender === 'user' ? 'text-gray-500' : 'text-gray-300'}`;
408
+ timestamp.textContent = new Date().toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'});
409
+
410
+ messageDiv.appendChild(messageContent);
411
+ messageDiv.appendChild(timestamp);
412
+ chatMessages.appendChild(messageDiv);
413
+
414
+ // Scroll to bottom
415
+ chatMessages.scrollTop = chatMessages.scrollHeight;
416
+ }
417
+
418
+ function addTypingIndicator() {
419
+ const typingDiv = document.createElement('div');
420
+ typingDiv.className = 'message-bubble bg-[#21223a] text-white rounded-2xl p-4 shadow-md';
421
+ typingDiv.id = 'typingIndicator';
422
+
423
+ const typingContent = document.createElement('div');
424
+ typingContent.className = 'typing-indicator';
425
+
426
+ for (let i = 0; i < 3; i++) {
427
+ const dot = document.createElement('div');
428
+ dot.className = 'typing-dot';
429
+ typingContent.appendChild(dot);
430
+ }
431
+
432
+ typingDiv.appendChild(typingContent);
433
+ chatMessages.appendChild(typingDiv);
434
+
435
+ // Scroll to bottom
436
+ chatMessages.scrollTop = chatMessages.scrollHeight;
437
+ }
438
+
439
+ function removeTypingIndicator() {
440
+ const typingIndicator = document.getElementById('typingIndicator');
441
+ if (typingIndicator) {
442
+ typingIndicator.remove();
443
+ }
444
+ }
445
+
446
+ function getAIResponse(userMessage) {
447
+ const responses = [
448
+ "Entendi sua pergunta! Deixe-me ajudar com isso...",
449
+ "Excelente pergunta! Aqui está a informação que você precisa:",
450
+ "Com base na sua solicitação, aqui está o que posso compartilhar:",
451
+ "Ótimo ponto! Deixe-me elaborar sobre isso:",
452
+ "Obrigado pela pergunta. Aqui está minha resposta:"
453
+ ];
454
+
455
+ return responses[Math.floor(Math.random() * responses.length)] + " Esta é uma resposta simulada do chatbot. Em uma implementação real, esta seria a resposta do modelo LLM selecionado.";
456
+ }
457
+ // Enter key to send message
458
+ messageInput.addEventListener('keypress', function(e) {
459
+ if (e.key === 'Enter') {
460
+ sendMessage();
461
+ }
462
+ });
463
+
464
+ // Drag and drop functionality
465
+ const dropArea = pdfFileInput.parentElement;
466
+
467
+ ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
468
+ dropArea.addEventListener(eventName, preventDefaults, false);
469
+ });
470
+
471
+ function preventDefaults(e) {
472
+ e.preventDefault();
473
+ e.stopPropagation();
474
+ }
475
+
476
+ ['dragenter', 'dragover'].forEach(eventName => {
477
+ dropArea.addEventListener(eventName, highlight, false);
478
+ });
479
+
480
+ ['dragleave', 'drop'].forEach(eventName => {
481
+ dropArea.addEventListener(eventName, unhighlight, false);
482
+ });
483
+
484
+ function highlight() {
485
+ dropArea.classList.add('border-[#ff580f]', 'bg-[#fff5f0]');
486
+ }
487
+
488
+ function unhighlight() {
489
+ dropArea.classList.remove('border-[#ff580f]', 'bg-[#fff5f0]');
490
+ }
491
+
492
+ dropArea.addEventListener('drop', handleDrop, false);
493
+
494
+ function handleDrop(e) {
495
+ const dt = e.dataTransfer;
496
+ const files = dt.files;
497
+ pdfFileInput.files = files;
498
+ }
499
+ // LLM selection
500
+ document.querySelectorAll('.llm-option').forEach(option => {
501
+ option.addEventListener('click', function() {
502
+ document.querySelectorAll('.llm-option').forEach(opt => {
503
+ opt.classList.remove('border-[#ff580f]');
504
+ });
505
+ this.classList.add('border-[#ff580f]');
506
+
507
+ const modelName = this.querySelector('span').textContent;
508
+ document.querySelector('.mt-3 span:first-child').textContent = `Modelo selecionado: ${modelName}`;
509
+ });
510
+ });
511
+ </script>
512
+
513
+
514
+ </div>
515
+ </div>
516
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
517
+ <script>
518
+ // Initialize Vanta.js background
519
+ VANTA.NET({
520
+ el: "#vanta-bg",
521
+ mouseControls: true,
522
+ touchControls: true,
523
+ gyroControls: false,
524
+ minHeight: 200.00,
525
+ minWidth: 200.00,
526
+ scale: 1.00,
527
+ scaleMobile: 1.00,
528
+ color: 0x3b82f6,
529
+ backgroundColor: 0xf8fafc,
530
+ points: 12.00,
531
+ maxDistance: 22.00,
532
+ spacing: 18.00
533
+ });
534
+ // Initialize feather icons
535
+ feather.replace();
536
+
537
+ // Pagination functionality
538
+ document.querySelectorAll('.pagination a').forEach(link => {
539
+ link.addEventListener('click', function(e) {
540
+ e.preventDefault();
541
+ // Here you would typically fetch the next page of results
542
+ // For demo purposes we'll just show an alert
543
+ if(this.textContent.trim() === '2' || this.textContent.trim() === '3') {
544
+ alert('Loading page ' + this.textContent.trim());
545
+ }
546
+ });
547
+ });
548
+ </script>
549
+ </body>
550
+ </html>