taprosoft commited on
Commit
111b79f
·
verified ·
1 Parent(s): 718aa37

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +6 -4
  2. index.html +559 -19
  3. prompts.txt +1 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Document Assistant
3
- emoji: 📚
4
  colorFrom: green
5
- colorTo: green
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: document-assistant
3
+ emoji: 🐳
4
  colorFrom: green
5
+ colorTo: yellow
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,559 @@
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="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Document Assistant</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ /* Custom scrollbar */
11
+ ::-webkit-scrollbar {
12
+ width: 6px;
13
+ }
14
+ ::-webkit-scrollbar-track {
15
+ background: #f1f1f1;
16
+ }
17
+ ::-webkit-scrollbar-thumb {
18
+ background: #888;
19
+ border-radius: 3px;
20
+ }
21
+ ::-webkit-scrollbar-thumb:hover {
22
+ background: #555;
23
+ }
24
+
25
+ /* PDF viewer styling */
26
+ .pdf-container {
27
+ height: calc(100vh - 150px);
28
+ overflow-y: auto;
29
+ }
30
+
31
+ /* Document preview transitions */
32
+ .document-preview {
33
+ transition: all 0.3s ease;
34
+ }
35
+
36
+ /* Chat message animations */
37
+ .message-enter {
38
+ animation: messageEnter 0.3s ease-out;
39
+ }
40
+
41
+ @keyframes messageEnter {
42
+ from {
43
+ opacity: 0;
44
+ transform: translateY(10px);
45
+ }
46
+ to {
47
+ opacity: 1;
48
+ transform: translateY(0);
49
+ }
50
+ }
51
+
52
+ /* Pulse animation for AI typing indicator */
53
+ @keyframes pulse {
54
+ 0%, 100% {
55
+ opacity: 1;
56
+ }
57
+ 50% {
58
+ opacity: 0.5;
59
+ }
60
+ }
61
+
62
+ .typing-dot {
63
+ animation: pulse 1.5s infinite ease-in-out;
64
+ }
65
+
66
+ .typing-dot:nth-child(1) {
67
+ animation-delay: 0s;
68
+ }
69
+
70
+ .typing-dot:nth-child(2) {
71
+ animation-delay: 0.3s;
72
+ }
73
+
74
+ .typing-dot:nth-child(3) {
75
+ animation-delay: 0.6s;
76
+ }
77
+ </style>
78
+ </head>
79
+ <body class="bg-gray-100 h-screen flex flex-col">
80
+ <header class="bg-indigo-600 text-white p-4 shadow-md">
81
+ <div class="container mx-auto flex justify-between items-center">
82
+ <div class="flex items-center space-x-2">
83
+ <i class="fas fa-robot text-2xl"></i>
84
+ <h1 class="text-xl font-bold">Document Assistant</h1>
85
+ </div>
86
+ <div class="flex items-center space-x-4">
87
+ <button class="bg-indigo-700 hover:bg-indigo-800 px-4 py-2 rounded-lg flex items-center">
88
+ <i class="fas fa-plus mr-2"></i>
89
+ New Document
90
+ </button>
91
+ <div class="relative">
92
+ <img src="https://randomuser.me/api/portraits/women/44.jpg" alt="User" class="w-8 h-8 rounded-full cursor-pointer">
93
+ <div class="absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg py-1 z-10 hidden">
94
+ <a href="#" class="block px-4 py-2 text-gray-800 hover:bg-gray-100">Profile</a>
95
+ <a href="#" class="block px-4 py-2 text-gray-800 hover:bg-gray-100">Settings</a>
96
+ <a href="#" class="block px-4 py-2 text-gray-800 hover:bg-gray-100">Sign out</a>
97
+ </div>
98
+ </div>
99
+ </div>
100
+ </div>
101
+ </header>
102
+
103
+ <div class="flex flex-1 overflow-hidden">
104
+ <!-- Left sidebar - Document selection -->
105
+ <div class="w-64 bg-white border-r border-gray-200 flex flex-col">
106
+ <div class="p-4 border-b border-gray-200">
107
+ <div class="relative">
108
+ <input type="text" placeholder="Search documents..." class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
109
+ <i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
110
+ </div>
111
+ </div>
112
+ <div class="flex-1 overflow-y-auto">
113
+ <div class="p-4">
114
+ <h3 class="text-sm font-semibold text-gray-500 uppercase tracking-wider mb-2">Recent Documents</h3>
115
+ <ul class="space-y-2">
116
+ <li class="p-2 hover:bg-gray-100 rounded-lg cursor-pointer flex items-center document-item active" data-doc="research-paper">
117
+ <i class="fas fa-file-pdf text-red-500 mr-3"></i>
118
+ <span>Research Paper.pdf</span>
119
+ </li>
120
+ <li class="p-2 hover:bg-gray-100 rounded-lg cursor-pointer flex items-center document-item" data-doc="business-plan">
121
+ <i class="fas fa-file-word text-blue-500 mr-3"></i>
122
+ <span>Business Plan.docx</span>
123
+ </li>
124
+ <li class="p-2 hover:bg-gray-100 rounded-lg cursor-pointer flex items-center document-item" data-doc="project-proposal">
125
+ <i class="fas fa-file-pdf text-red-500 mr-3"></i>
126
+ <span>Project Proposal.pdf</span>
127
+ </li>
128
+ <li class="p-2 hover:bg-gray-100 rounded-lg cursor-pointer flex items-center document-item" data-doc="meeting-notes">
129
+ <i class="fas fa-file-word text-blue-500 mr-3"></i>
130
+ <span>Meeting Notes.docx</span>
131
+ </li>
132
+ <li class="p-2 hover:bg-gray-100 rounded-lg cursor-pointer flex items-center document-item" data-doc="web-content">
133
+ <i class="fas fa-file-code text-green-500 mr-3"></i>
134
+ <span>Web Content.html</span>
135
+ </li>
136
+ </ul>
137
+ </div>
138
+ <div class="p-4 border-t border-gray-200">
139
+ <h3 class="text-sm font-semibold text-gray-500 uppercase tracking-wider mb-2">Collections</h3>
140
+ <ul class="space-y-2">
141
+ <li class="p-2 hover:bg-gray-100 rounded-lg cursor-pointer flex items-center">
142
+ <i class="fas fa-folder text-yellow-500 mr-3"></i>
143
+ <span>Work Projects</span>
144
+ </li>
145
+ <li class="p-2 hover:bg-gray-100 rounded-lg cursor-pointer flex items-center">
146
+ <i class="fas fa-folder text-yellow-500 mr-3"></i>
147
+ <span>Personal Research</span>
148
+ </li>
149
+ <li class="p-2 hover:bg-gray-100 rounded-lg cursor-pointer flex items-center">
150
+ <i class="fas fa-folder text-yellow-500 mr-3"></i>
151
+ <span>Archived</span>
152
+ </li>
153
+ </ul>
154
+ </div>
155
+ </div>
156
+ <div class="p-4 border-t border-gray-200 bg-gray-50">
157
+ <button class="w-full bg-indigo-600 hover:bg-indigo-700 text-white py-2 px-4 rounded-lg flex items-center justify-center">
158
+ <i class="fas fa-upload mr-2"></i>
159
+ Upload Document
160
+ </button>
161
+ </div>
162
+ </div>
163
+
164
+ <!-- Main chat area -->
165
+ <div class="flex-1 flex flex-col bg-white">
166
+ <div class="flex-1 overflow-y-auto p-4 space-y-4" id="chat-container">
167
+ <!-- Welcome message -->
168
+ <div class="message-enter flex space-x-3">
169
+ <div class="flex-shrink-0">
170
+ <div class="h-10 w-10 rounded-full bg-indigo-100 flex items-center justify-center">
171
+ <i class="fas fa-robot text-indigo-600"></i>
172
+ </div>
173
+ </div>
174
+ <div class="bg-gray-100 rounded-lg p-4 max-w-3xl">
175
+ <p class="text-gray-800">Hello! I'm your Document Assistant. I can help you analyze and cite documents. Select a document from the left sidebar to get started.</p>
176
+ </div>
177
+ </div>
178
+
179
+ <!-- Sample chat messages will be added here by JavaScript -->
180
+ </div>
181
+
182
+ <!-- Input area -->
183
+ <div class="p-4 border-t border-gray-200 bg-white">
184
+ <div class="flex items-center space-x-2">
185
+ <button class="p-2 text-gray-500 hover:text-gray-700 rounded-full hover:bg-gray-100">
186
+ <i class="fas fa-paperclip"></i>
187
+ </button>
188
+ <div class="flex-1 relative">
189
+ <textarea id="message-input" rows="1" placeholder="Ask about the document..." class="w-full border border-gray-300 rounded-lg py-3 px-4 focus:outline-none focus:ring-2 focus:ring-indigo-500 resize-none" style="min-height: 50px;"></textarea>
190
+ <button id="send-button" class="absolute right-2 bottom-2 bg-indigo-600 text-white p-1 rounded-full w-8 h-8 flex items-center justify-center hover:bg-indigo-700">
191
+ <i class="fas fa-paper-plane"></i>
192
+ </button>
193
+ </div>
194
+ </div>
195
+ <div class="mt-2 text-xs text-gray-500">
196
+ <p>Document Assistant may produce inaccurate information about people, places, or facts. Always verify citations.</p>
197
+ </div>
198
+ </div>
199
+ </div>
200
+
201
+ <!-- Right sidebar - Document preview -->
202
+ <div class="w-80 bg-white border-l border-gray-200 flex flex-col document-preview">
203
+ <div class="p-4 border-b border-gray-200 flex justify-between items-center">
204
+ <h2 class="font-semibold text-gray-800">Document Preview</h2>
205
+ <button class="text-gray-500 hover:text-gray-700">
206
+ <i class="fas fa-times"></i>
207
+ </button>
208
+ </div>
209
+ <div class="flex-1 overflow-y-auto p-4">
210
+ <!-- Default state when no document is selected -->
211
+ <div id="no-document-selected" class="h-full flex flex-col items-center justify-center text-center text-gray-500">
212
+ <i class="fas fa-file-alt text-4xl mb-4"></i>
213
+ <p>Select a document from the left sidebar to view it here</p>
214
+ </div>
215
+
216
+ <!-- PDF Preview -->
217
+ <div id="research-paper-preview" class="hidden">
218
+ <div class="flex items-center justify-between mb-4">
219
+ <div class="flex items-center">
220
+ <i class="fas fa-file-pdf text-red-500 mr-2"></i>
221
+ <h3 class="font-medium">Research Paper.pdf</h3>
222
+ </div>
223
+ <div class="flex space-x-2">
224
+ <button class="p-1 text-gray-500 hover:text-gray-700">
225
+ <i class="fas fa-download"></i>
226
+ </button>
227
+ <button class="p-1 text-gray-500 hover:text-gray-700">
228
+ <i class="fas fa-print"></i>
229
+ </button>
230
+ </div>
231
+ </div>
232
+
233
+ <div class="pdf-container bg-gray-100 rounded-lg p-4 mb-4">
234
+ <div class="bg-white p-6 shadow-sm mb-4">
235
+ <h2 class="text-xl font-bold mb-2">The Impact of Artificial Intelligence on Modern Business</h2>
236
+ <p class="text-sm text-gray-500 mb-4">By: Dr. Sarah Johnson, Published: March 2023</p>
237
+ <p class="text-sm mb-4">Abstract: This paper examines the transformative effects of artificial intelligence on various business sectors, focusing on productivity gains, workforce implications, and ethical considerations...</p>
238
+ <div class="border-t pt-4">
239
+ <p class="text-xs text-gray-500">Pages: 1 of 24 | Last updated: 2 days ago</p>
240
+ </div>
241
+ </div>
242
+
243
+ <div class="bg-white p-6 shadow-sm">
244
+ <h3 class="font-bold mb-2">1. Introduction</h3>
245
+ <p class="text-sm mb-4">Artificial Intelligence (AI) has emerged as one of the most significant technological advancements of the 21st century. Its applications span across industries, from healthcare to finance, revolutionizing traditional business models and operational processes...</p>
246
+
247
+ <h3 class="font-bold mb-2">2. Methodology</h3>
248
+ <p class="text-sm mb-4">Our research methodology combines quantitative analysis of industry data with qualitative interviews from 50 business leaders across different sectors...</p>
249
+
250
+ <div class="border-t pt-4">
251
+ <p class="text-xs text-gray-500">Pages: 2 of 24</p>
252
+ </div>
253
+ </div>
254
+ </div>
255
+
256
+ <div class="bg-indigo-50 p-4 rounded-lg">
257
+ <h4 class="font-medium text-sm mb-2">Suggested Citations</h4>
258
+ <div class="bg-white p-3 rounded text-xs mb-2">
259
+ <p>APA: Johnson, S. (2023). The Impact of Artificial Intelligence on Modern Business. <em>Journal of Business Technology</em>, 15(2), 45-68.</p>
260
+ </div>
261
+ <div class="bg-white p-3 rounded text-xs">
262
+ <p>MLA: Johnson, Sarah. "The Impact of Artificial Intelligence on Modern Business." <em>Journal of Business Technology</em>, vol. 15, no. 2, 2023, pp. 45-68.</p>
263
+ </div>
264
+ </div>
265
+ </div>
266
+
267
+ <!-- DOCX Preview -->
268
+ <div id="business-plan-preview" class="hidden">
269
+ <div class="flex items-center justify-between mb-4">
270
+ <div class="flex items-center">
271
+ <i class="fas fa-file-word text-blue-500 mr-2"></i>
272
+ <h3 class="font-medium">Business Plan.docx</h3>
273
+ </div>
274
+ <div class="flex space-x-2">
275
+ <button class="p-1 text-gray-500 hover:text-gray-700">
276
+ <i class="fas fa-download"></i>
277
+ </button>
278
+ <button class="p-1 text-gray-500 hover:text-gray-700">
279
+ <i class="fas fa-print"></i>
280
+ </button>
281
+ </div>
282
+ </div>
283
+
284
+ <div class="bg-gray-100 rounded-lg p-4 mb-4">
285
+ <div class="bg-white p-6 shadow-sm">
286
+ <h2 class="text-xl font-bold mb-4 text-center">TechStart Business Plan</h2>
287
+
288
+ <h3 class="font-bold mb-2">Executive Summary</h3>
289
+ <p class="text-sm mb-4">TechStart is a technology consulting firm specializing in helping small businesses implement digital transformation strategies. Our services include website development, cloud migration, and AI integration...</p>
290
+
291
+ <h3 class="font-bold mb-2">Market Analysis</h3>
292
+ <p class="text-sm mb-4">The small business technology consulting market is valued at $12 billion annually, with an expected growth rate of 8% over the next five years...</p>
293
+
294
+ <h3 class="font-bold mb-2">Financial Projections</h3>
295
+ <p class="text-sm mb-4">Year 1 Revenue: $500,000<br>Year 2 Revenue: $1.2 million<br>Year 3 Revenue: $2.5 million</p>
296
+
297
+ <div class="border-t pt-4">
298
+ <p class="text-xs text-gray-500">Last updated: 1 week ago</p>
299
+ </div>
300
+ </div>
301
+ </div>
302
+
303
+ <div class="bg-indigo-50 p-4 rounded-lg">
304
+ <h4 class="font-medium text-sm mb-2">Document Information</h4>
305
+ <div class="grid grid-cols-2 gap-2 text-xs">
306
+ <div>
307
+ <p class="text-gray-500">Author:</p>
308
+ <p>Alex Turner</p>
309
+ </div>
310
+ <div>
311
+ <p class="text-gray-500">Created:</p>
312
+ <p>January 15, 2023</p>
313
+ </div>
314
+ <div>
315
+ <p class="text-gray-500">Word Count:</p>
316
+ <p>4,582</p>
317
+ </div>
318
+ <div>
319
+ <p class="text-gray-500">Pages:</p>
320
+ <p>12</p>
321
+ </div>
322
+ </div>
323
+ </div>
324
+ </div>
325
+
326
+ <!-- HTML Preview -->
327
+ <div id="web-content-preview" class="hidden">
328
+ <div class="flex items-center justify-between mb-4">
329
+ <div class="flex items-center">
330
+ <i class="fas fa-file-code text-green-500 mr-2"></i>
331
+ <h3 class="font-medium">Web Content.html</h3>
332
+ </div>
333
+ <div class="flex space-x-2">
334
+ <button class="p-1 text-gray-500 hover:text-gray-700">
335
+ <i class="fas fa-download"></i>
336
+ </button>
337
+ <button class="p-1 text-gray-500 hover:text-gray-700">
338
+ <i class="fas fa-code"></i>
339
+ </button>
340
+ </div>
341
+ </div>
342
+
343
+ <div class="bg-gray-100 rounded-lg p-4 mb-4">
344
+ <div class="bg-white p-6 shadow-sm">
345
+ <h1 class="text-2xl font-bold mb-4">Sustainable Web Design Practices</h1>
346
+
347
+ <div class="prose prose-sm max-w-none">
348
+ <p>In the digital age, sustainability isn't just about physical products - it extends to our online presence as well. Sustainable web design focuses on creating websites that are efficient, accessible, and environmentally friendly.</p>
349
+
350
+ <h2>Key Principles</h2>
351
+ <ul>
352
+ <li>Optimized images and media</li>
353
+ <li>Efficient code structure</li>
354
+ <li>Green hosting solutions</li>
355
+ <li>Dark mode implementation</li>
356
+ <li>Reduced JavaScript dependencies</li>
357
+ </ul>
358
+
359
+ <h2>Performance Metrics</h2>
360
+ <p>A sustainable website should aim for:</p>
361
+ <table class="w-full border">
362
+ <thead>
363
+ <tr class="bg-gray-50">
364
+ <th class="p-2 text-left border">Metric</th>
365
+ <th class="p-2 text-left border">Target</th>
366
+ </tr>
367
+ </thead>
368
+ <tbody>
369
+ <tr>
370
+ <td class="p-2 border">Page Weight</td>
371
+ <td class="p-2 border">&lt; 1MB</td>
372
+ </tr>
373
+ <tr class="bg-gray-50">
374
+ <td class="p-2 border">Load Time</td>
375
+ <td class="p-2 border">&lt; 2s</td>
376
+ </tr>
377
+ <tr>
378
+ <td class="p-2 border">Carbon Footprint</td>
379
+ <td class="p-2 border">&lt; 0.5g CO2/page view</td>
380
+ </tr>
381
+ </tbody>
382
+ </table>
383
+ </div>
384
+
385
+ <div class="border-t pt-4 mt-4">
386
+ <p class="text-xs text-gray-500">Last updated: 3 days ago</p>
387
+ </div>
388
+ </div>
389
+ </div>
390
+
391
+ <div class="bg-indigo-50 p-4 rounded-lg">
392
+ <h4 class="font-medium text-sm mb-2">Code Snippets</h4>
393
+ <pre class="bg-gray-800 text-gray-100 p-3 rounded text-xs overflow-x-auto">
394
+ &lt;!-- Example of optimized image --&gt;
395
+ &lt;picture&gt;
396
+ &lt;source srcset="image.webp" type="image/webp"&gt;
397
+ &lt;source srcset="image.jpg" type="image/jpeg"&gt;
398
+ &lt;img src="image.jpg" alt="Description" loading="lazy"&gt;
399
+ &lt;/picture&gt;
400
+ </pre>
401
+ </div>
402
+ </div>
403
+ </div>
404
+ </div>
405
+ </div>
406
+
407
+ <script>
408
+ document.addEventListener('DOMContentLoaded', function() {
409
+ // Document selection
410
+ const documentItems = document.querySelectorAll('.document-item');
411
+ const noDocumentSelected = document.getElementById('no-document-selected');
412
+ const previewContainers = document.querySelectorAll('[id$="-preview"]');
413
+
414
+ documentItems.forEach(item => {
415
+ item.addEventListener('click', function() {
416
+ // Remove active class from all items
417
+ documentItems.forEach(i => i.classList.remove('active'));
418
+ // Add active class to clicked item
419
+ this.classList.add('active');
420
+
421
+ // Get the document ID
422
+ const docId = this.getAttribute('data-doc');
423
+
424
+ // Hide all preview containers
425
+ previewContainers.forEach(container => {
426
+ container.classList.add('hidden');
427
+ });
428
+
429
+ // Hide the no document selected message
430
+ noDocumentSelected.classList.add('hidden');
431
+
432
+ // Show the selected preview container
433
+ document.getElementById(`${docId}-preview`).classList.remove('hidden');
434
+
435
+ // Add a message to the chat about the document selection
436
+ addMessageToChat('user', `I've selected ${this.querySelector('span').textContent}`);
437
+
438
+ // Simulate AI response
439
+ setTimeout(() => {
440
+ addMessageToChat('assistant', `You've selected ${this.querySelector('span').textContent}. I can help you analyze this document. What would you like to know?`);
441
+ }, 1000);
442
+ });
443
+ });
444
+
445
+ // Chat functionality
446
+ const chatContainer = document.getElementById('chat-container');
447
+ const messageInput = document.getElementById('message-input');
448
+ const sendButton = document.getElementById('send-button');
449
+
450
+ function addMessageToChat(role, content) {
451
+ const messageDiv = document.createElement('div');
452
+ messageDiv.classList.add('message-enter', 'flex', 'space-x-3');
453
+
454
+ if (role === 'user') {
455
+ messageDiv.innerHTML = `
456
+ <div class="flex-shrink-0">
457
+ <div class="h-10 w-10 rounded-full bg-gray-200 flex items-center justify-center">
458
+ <i class="fas fa-user text-gray-600"></i>
459
+ </div>
460
+ </div>
461
+ <div class="bg-indigo-100 rounded-lg p-4 max-w-3xl">
462
+ <p class="text-gray-800">${content}</p>
463
+ </div>
464
+ `;
465
+ } else {
466
+ messageDiv.innerHTML = `
467
+ <div class="flex-shrink-0">
468
+ <div class="h-10 w-10 rounded-full bg-indigo-100 flex items-center justify-center">
469
+ <i class="fas fa-robot text-indigo-600"></i>
470
+ </div>
471
+ </div>
472
+ <div class="bg-gray-100 rounded-lg p-4 max-w-3xl">
473
+ <p class="text-gray-800">${content}</p>
474
+ </div>
475
+ `;
476
+ }
477
+
478
+ chatContainer.appendChild(messageDiv);
479
+ chatContainer.scrollTop = chatContainer.scrollHeight;
480
+ }
481
+
482
+ function sendMessage() {
483
+ const message = messageInput.value.trim();
484
+ if (message) {
485
+ addMessageToChat('user', message);
486
+ messageInput.value = '';
487
+
488
+ // Show typing indicator
489
+ const typingDiv = document.createElement('div');
490
+ typingDiv.classList.add('flex', 'space-x-3', 'items-center');
491
+ typingDiv.innerHTML = `
492
+ <div class="flex-shrink-0">
493
+ <div class="h-10 w-10 rounded-full bg-indigo-100 flex items-center justify-center">
494
+ <i class="fas fa-robot text-indigo-600"></i>
495
+ </div>
496
+ </div>
497
+ <div class="bg-gray-100 rounded-lg p-4 max-w-xs">
498
+ <div class="flex space-x-1">
499
+ <div class="typing-dot h-2 w-2 bg-gray-500 rounded-full"></div>
500
+ <div class="typing-dot h-2 w-2 bg-gray-500 rounded-full"></div>
501
+ <div class="typing-dot h-2 w-2 bg-gray-500 rounded-full"></div>
502
+ </div>
503
+ </div>
504
+ `;
505
+ chatContainer.appendChild(typingDiv);
506
+ chatContainer.scrollTop = chatContainer.scrollHeight;
507
+
508
+ // Simulate AI response after a delay
509
+ setTimeout(() => {
510
+ // Remove typing indicator
511
+ chatContainer.removeChild(typingDiv);
512
+
513
+ // Add response
514
+ const responses = [
515
+ "Based on the document, I found that...",
516
+ "The document mentions this information...",
517
+ "Here's a relevant citation from the document...",
518
+ "According to the document, the key points are...",
519
+ "I've analyzed the document and here's what I found..."
520
+ ];
521
+ const randomResponse = responses[Math.floor(Math.random() * responses.length)];
522
+ addMessageToChat('assistant', randomResponse);
523
+ }, 1500 + Math.random() * 2000);
524
+ }
525
+ }
526
+
527
+ sendButton.addEventListener('click', sendMessage);
528
+
529
+ messageInput.addEventListener('keypress', function(e) {
530
+ if (e.key === 'Enter' && !e.shiftKey) {
531
+ e.preventDefault();
532
+ sendMessage();
533
+ }
534
+ });
535
+
536
+ // Auto-resize textarea
537
+ messageInput.addEventListener('input', function() {
538
+ this.style.height = 'auto';
539
+ this.style.height = (this.scrollHeight) + 'px';
540
+ });
541
+
542
+ // Toggle user dropdown
543
+ const userAvatar = document.querySelector('.relative img');
544
+ const userDropdown = document.querySelector('.relative .hidden');
545
+
546
+ userAvatar.addEventListener('click', function() {
547
+ userDropdown.classList.toggle('hidden');
548
+ });
549
+
550
+ // Close dropdown when clicking outside
551
+ document.addEventListener('click', function(e) {
552
+ if (!e.target.closest('.relative')) {
553
+ userDropdown.classList.add('hidden');
554
+ }
555
+ });
556
+ });
557
+ </script>
558
+ <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=taprosoft/document-assistant" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
559
+ </html>
prompts.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ Build a ChatGPT like UI with document selection on left side bar, document preview for PDF / DOCX / HTML on the right side bar to display citation