dataquantals commited on
Commit
cd9d9ca
·
verified ·
1 Parent(s): a63b373

undefined - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. index.html +287 -358
index.html CHANGED
@@ -3,23 +3,14 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Notes - Quantals Collect</title>
7
  <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
8
  <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
9
- <script src="https://cdn.jsdelivr.net/npm/@tiptap/core@2.0.0-beta.209"></script>
10
- <script src="https://cdn.jsdelivr.net/npm/@tiptap/starter-kit@2.0.0-beta.209"></script>
11
- <script src="https://cdn.jsdelivr.net/npm/@tiptap/extension-link@2.0.0-beta.209"></script>
12
- <script src="https://cdn.jsdelivr.net/npm/@tiptap/extension-image@2.0.0-beta.209"></script>
13
- <script src="https://cdn.jsdelivr.net/npm/@tiptap/extension-placeholder@2.0.0-beta.209"></script>
14
- <script src="https://cdn.jsdelivr.net/npm/@tiptap/extension-task-list@2.0.0-beta.209"></script>
15
- <script src="https://cdn.jsdelivr.net/npm/@tiptap/extension-task-item@2.0.0-beta.209"></script>
16
- <script src="https://cdn.jsdelivr.net/npm/lunr@2.3.9/lunr.min.js"></script>
17
- <script src="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.js"></script>
18
- <link href="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.css" rel="stylesheet">
19
  </head>
20
- <body class="bg-gray-50 dark:bg-gray-900">
21
  <!-- Main Navigation -->
22
- <nav class="bg-white dark:bg-gray-800 shadow-sm">
23
  <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
24
  <div class="flex justify-between h-16">
25
  <div class="flex">
@@ -27,30 +18,23 @@
27
  <img class="h-8 w-auto" src="assets/logo.svg" alt="Quantals Collect">
28
  </div>
29
  <div class="hidden sm:ml-6 sm:flex sm:space-x-8">
30
- <a href="Dashboard.html" class="border-transparent text-gray-500 dark:text-gray-300 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">
31
  Dashboard
32
  </a>
33
- <a href="Projects.html" class="border-transparent text-gray-500 dark:text-gray-300 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">
34
  Projects
35
  </a>
36
- <a href="Participants.html" class="border-transparent text-gray-500 dark:text-gray-300 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">
37
  Participants
38
  </a>
39
- <a href="Analysis.html" class="border-transparent text-gray-500 dark:text-gray-300 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">
40
  Analysis
41
  </a>
42
- <a href="Notes.html" class="border-indigo-500 text-indigo-600 dark:text-indigo-400 border-b-2 inline-flex items-center px-1 pt-1 text-sm font-medium">
43
- <i class="fas fa-sticky-note mr-2"></i>
44
- Notes
45
  </a>
46
  </div>
47
  </div>
48
- <div class="flex items-center">
49
- <button onclick="toggleDarkMode()" class="p-2 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300">
50
- <i class="fas fa-moon dark:hidden"></i>
51
- <i class="fas fa-sun hidden dark:block"></i>
52
- </button>
53
- </div>
54
  </div>
55
  </div>
56
  </nav>
@@ -58,135 +42,104 @@
58
  <!-- Main Content -->
59
  <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
60
  <div class="grid grid-cols-12 gap-6">
61
- <!-- Left Sidebar -->
62
  <div class="col-span-3">
63
- <div class="bg-white dark:bg-gray-800 rounded-lg shadow p-4">
64
- <div class="space-y-6">
65
- <!-- Note Type Filter -->
66
- <div>
67
- <h3 class="text-lg font-medium text-gray-900 dark:text-white mb-4">Note Types</h3>
68
- <div class="space-y-2">
69
- <button onclick="filterNotes('all')" class="w-full flex items-center p-2 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700">
70
- <i class="fas fa-list text-indigo-600 dark:text-indigo-400 w-5 h-5"></i>
71
- <span class="ml-3 text-sm font-medium text-gray-900 dark:text-white">All Notes</span>
72
- </button>
73
- <button onclick="filterNotes('observation')" class="w-full flex items-center p-2 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700">
74
- <i class="fas fa-eye text-indigo-600 dark:text-indigo-400 w-5 h-5"></i>
75
- <span class="ml-3 text-sm font-medium text-gray-900 dark:text-white">Observations</span>
76
- </button>
77
- <button onclick="filterNotes('memo')" class="w-full flex items-center p-2 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700">
78
- <i class="fas fa-file-alt text-indigo-600 dark:text-indigo-400 w-5 h-5"></i>
79
- <span class="ml-3 text-sm font-medium text-gray-900 dark:text-white">Memos</span>
80
- </button>
81
- <button onclick="filterNotes('theory')" class="w-full flex items-center p-2 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700">
82
- <i class="fas fa-lightbulb text-indigo-600 dark:text-indigo-400 w-5 h-5"></i>
83
- <span class="ml-3 text-sm font-medium text-gray-900 dark:text-white">Theories</span>
84
- </button>
85
- </div>
86
- </div>
87
-
88
- <!-- Linked Entities -->
89
- <div>
90
- <h3 class="text-lg font-medium text-gray-900 dark:text-white mb-4">Linked Entities</h3>
91
- <div class="space-y-2">
92
- <div class="p-2 bg-gray-50 dark:bg-gray-700 rounded-lg">
93
- <h4 class="text-sm font-medium text-gray-900 dark:text-white mb-2">Participants</h4>
94
- <div class="space-y-1">
95
- <div class="flex items-center p-1 hover:bg-gray-100 dark:hover:bg-gray-600 rounded cursor-pointer">
96
- <span class="text-sm text-gray-600 dark:text-gray-300">P-12 (Female, 35)</span>
97
- </div>
98
- <div class="flex items-center p-1 hover:bg-gray-100 dark:hover:bg-gray-600 rounded cursor-pointer">
99
- <span class="text-sm text-gray-600 dark:text-gray-300">P-13 (Male, 42)</span>
100
- </div>
101
- </div>
102
- </div>
103
- <div class="p-2 bg-gray-50 dark:bg-gray-700 rounded-lg">
104
- <h4 class="text-sm font-medium text-gray-900 dark:text-white mb-2">Interviews</h4>
105
- <div class="space-y-1">
106
- <div class="flex items-center p-1 hover:bg-gray-100 dark:hover:bg-gray-600 rounded cursor-pointer">
107
- <span class="text-sm text-gray-600 dark:text-gray-300">Interview #23</span>
108
- </div>
109
- <div class="flex items-center p-1 hover:bg-gray-100 dark:hover:bg-gray-600 rounded cursor-pointer">
110
- <span class="text-sm text-gray-600 dark:text-gray-300">Interview #24</span>
111
- </div>
112
- </div>
113
- </div>
114
- </div>
115
- </div>
116
-
117
- <!-- Tags -->
118
- <div>
119
- <h3 class="text-lg font-medium text-gray-900 dark:text-white mb-4">Tags</h3>
120
- <div class="flex flex-wrap gap-2">
121
- <span class="px-2 py-1 bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200 rounded-full text-xs">#urban_planning</span>
122
- <span class="px-2 py-1 bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200 rounded-full text-xs">#safety</span>
123
- <span class="px-2 py-1 bg-yellow-100 dark:bg-yellow-900 text-yellow-800 dark:text-yellow-200 rounded-full text-xs">#infrastructure</span>
124
- </div>
125
- </div>
126
  </div>
127
  </div>
128
  </div>
129
 
130
- <!-- Main Content Area -->
131
  <div class="col-span-9 space-y-6">
132
- <!-- Note Editor -->
133
- <div class="bg-white dark:bg-gray-800 rounded-lg shadow">
134
- <div class="p-4 border-b border-gray-200 dark:border-gray-700">
135
- <div class="flex justify-between items-center">
136
- <div class="flex space-x-2">
137
- <button onclick="formatText('bold')" class="p-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300">
138
- <i class="fas fa-bold"></i>
139
- </button>
140
- <button onclick="formatText('italic')" class="p-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300">
141
- <i class="fas fa-italic"></i>
142
- </button>
143
- <button onclick="formatText('heading')" class="p-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300">
144
- <i class="fas fa-heading"></i>
145
- </button>
146
- <button onclick="insertLink()" class="p-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300">
147
- <i class="fas fa-link"></i>
148
- </button>
149
- <button onclick="insertImage()" class="p-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300">
150
- <i class="fas fa-image"></i>
151
- </button>
152
- <button onclick="insertEquation()" class="p-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300">
153
- <i class="fas fa-square-root-alt"></i>
154
- </button>
155
  </div>
156
- <div class="flex space-x-2">
157
- <button onclick="saveNote()" class="px-4 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700">
158
- <i class="fas fa-save mr-2"></i>
159
- Save
160
- </button>
161
  </div>
162
  </div>
163
  </div>
164
- <div class="p-4">
165
- <div id="editor" class="prose dark:prose-invert max-w-none min-h-[500px] focus:outline-none" role="textbox" aria-label="Research note" tabindex="0" aria-description="Press Ctrl+Alt+L to link to participants"></div>
166
- </div>
167
  </div>
168
 
169
- <!-- Note List -->
170
- <div class="bg-white dark:bg-gray-800 rounded-lg shadow">
171
- <div class="p-4 border-b border-gray-200 dark:border-gray-700">
172
- <div class="flex justify-between items-center">
173
- <h3 class="text-lg font-medium text-gray-900 dark:text-white">Recent Notes</h3>
174
- <div class="flex space-x-2">
175
- <button onclick="changeView('timeline')" class="p-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300">
176
- <i class="fas fa-clock"></i>
177
- </button>
178
- <button onclick="changeView('network')" class="p-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300">
179
- <i class="fas fa-project-diagram"></i>
180
- </button>
181
- <button onclick="changeView('table')" class="p-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300">
182
- <i class="fas fa-table"></i>
183
  </button>
184
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  </div>
186
  </div>
187
- <div class="p-4">
188
- <div id="noteList" class="space-y-4">
189
- <!-- Note cards will be dynamically inserted here -->
 
190
  </div>
191
  </div>
192
  </div>
@@ -194,275 +147,251 @@
194
  </div>
195
  </div>
196
 
197
- <!-- Offline Banner -->
198
- <div id="offlineBanner" class="hidden fixed bottom-0 left-0 right-0 bg-yellow-500 text-white p-4 text-center">
199
- <i class="fas fa-wifi-slash mr-2"></i>
200
- You are currently offline. Changes will be saved locally.
 
 
 
 
201
  </div>
202
 
203
  <!-- Scripts -->
204
  <script>
205
- // Initialize TipTap editor
206
- const editor = new Editor({
207
- element: document.querySelector('#editor'),
208
- extensions: [
209
- StarterKit,
210
- Link,
211
- Image,
212
- Placeholder.configure({
213
- placeholder: 'Start writing your note...',
214
- }),
215
- TaskList,
216
- TaskItem,
217
- ],
218
- content: '',
219
- onUpdate: ({ editor }) => {
220
- // Auto-save functionality
221
- saveNote();
222
- },
223
- });
224
-
225
- // Initialize IndexedDB
226
- const db = new Dexie('NotesDB');
227
- db.version(1).stores({
228
- notes: '++id, content, type, linkedTo, createdAt, lastEdited',
229
- versionHistory: '++id, noteId, content, timestamp',
230
- });
231
-
232
- // State management
233
- let currentView = 'timeline';
234
- let currentFilter = 'all';
235
- let isOffline = false;
236
-
237
- // Note management
238
- function saveNote() {
239
- const content = editor.getHTML();
240
- const note = {
241
- content,
242
- type: 'memo', // Default type
243
- linkedTo: {
244
- participants: [],
245
- interviews: [],
246
- codes: [],
247
- },
248
- createdAt: new Date().toISOString(),
249
- lastEdited: new Date().toISOString(),
250
- };
251
-
252
- if (isOffline) {
253
- // Save to IndexedDB
254
- db.notes.add(note);
255
- } else {
256
- // Save to server
257
- saveToServer(note);
258
- }
259
- }
260
-
261
- function saveToServer(note) {
262
- fetch('/api/notes', {
263
- method: 'POST',
264
- headers: {
265
- 'Content-Type': 'application/json',
266
- },
267
- body: JSON.stringify(note),
268
- })
269
- .then(response => response.json())
270
- .then(data => {
271
- console.log('Note saved:', data);
272
- })
273
- .catch(error => {
274
- console.error('Error saving note:', error);
275
- // Fallback to IndexedDB
276
- db.notes.add(note);
277
  });
 
278
  }
279
 
280
- // View management
281
- function changeView(view) {
282
- currentView = view;
283
- updateNoteList();
284
  }
285
 
286
- function updateNoteList() {
287
- const noteList = document.getElementById('noteList');
288
- noteList.innerHTML = ''; // Clear existing notes
 
 
 
 
 
 
 
 
 
289
 
290
- // Fetch notes based on current view and filter
291
- fetchNotes().then(notes => {
292
- notes.forEach(note => {
293
- const noteCard = createNoteCard(note);
294
- noteList.appendChild(noteCard);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
  });
296
- });
297
- }
298
 
299
- function createNoteCard(note) {
300
- const card = document.createElement('div');
301
- card.className = 'bg-white dark:bg-gray-800 rounded-lg shadow p-4';
302
- card.innerHTML = `
303
- <div class="flex justify-between items-start">
304
- <div>
305
- <h4 class="text-lg font-medium text-gray-900 dark:text-white">${note.title}</h4>
306
- <p class="text-sm text-gray-500 dark:text-gray-400">${formatDate(note.lastEdited)}</p>
307
- </div>
308
- <div class="flex space-x-2">
309
- <button onclick="editNote('${note.id}')" class="p-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300">
310
- <i class="fas fa-edit"></i>
311
- </button>
312
- <button onclick="deleteNote('${note.id}')" class="p-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300">
313
- <i class="fas fa-trash"></i>
314
- </button>
315
- </div>
316
- </div>
317
- <div class="mt-2">
318
- <div class="prose dark:prose-invert max-w-none">${note.content}</div>
319
- </div>
320
- <div class="mt-4 flex flex-wrap gap-2">
321
- ${note.tags.map(tag => `
322
- <span class="px-2 py-1 bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200 rounded-full text-xs">${tag}</span>
323
- `).join('')}
324
- </div>
325
- `;
326
- return card;
327
  }
328
 
329
- // Formatting functions
330
- function formatText(type) {
331
- switch (type) {
332
- case 'bold':
333
- editor.chain().focus().toggleBold().run();
334
- break;
335
- case 'italic':
336
- editor.chain().focus().toggleItalic().run();
337
- break;
338
- case 'heading':
339
- editor.chain().focus().toggleHeading({ level: 2 }).run();
340
- break;
341
- }
342
  }
343
 
344
- function insertLink() {
345
- const url = prompt('Enter URL:');
346
- if (url) {
347
- editor.chain().focus().setLink({ href: url }).run();
348
- }
349
  }
350
 
351
- function insertImage() {
352
- const url = prompt('Enter image URL:');
353
- if (url) {
354
- editor.chain().focus().setImage({ src: url }).run();
355
- }
356
  }
357
 
358
- function insertEquation() {
359
- const equation = prompt('Enter LaTeX equation:');
360
- if (equation) {
361
- const rendered = katex.renderToString(equation);
362
- editor.chain().focus().insertContent(rendered).run();
363
- }
 
 
 
 
 
 
 
364
  }
365
 
366
- // Utility functions
367
- function formatDate(date) {
368
- return new Date(date).toLocaleDateString();
 
 
 
 
369
  }
370
 
371
- function toggleDarkMode() {
372
- document.documentElement.classList.toggle('dark');
 
 
 
 
 
 
 
 
 
373
  }
374
 
375
- // Offline detection
376
- function checkOnlineStatus() {
377
- isOffline = !navigator.onLine;
378
- document.getElementById('offlineBanner').classList.toggle('hidden', !isOffline);
 
 
 
 
379
  }
380
 
381
- window.addEventListener('online', checkOnlineStatus);
382
- window.addEventListener('offline', checkOnlineStatus);
 
 
383
 
384
- // Initialize
385
- document.addEventListener('DOMContentLoaded', function() {
386
- checkOnlineStatus();
387
- updateNoteList();
388
  });
389
  </script>
390
 
391
  <!-- Styles -->
392
  <style>
393
- /* Dark mode styles */
394
- .dark {
395
- color-scheme: dark;
396
- }
397
-
398
- .dark .prose {
399
- color: #e5e7eb;
400
  }
401
 
402
- .dark .prose h1,
403
- .dark .prose h2,
404
- .dark .prose h3,
405
- .dark .prose h4 {
406
- color: #f3f4f6;
 
 
407
  }
408
 
409
- /* Editor styles */
410
- .ProseMirror {
411
- min-height: 500px;
412
- padding: 1rem;
 
 
 
413
  }
414
 
415
- .ProseMirror:focus {
416
- outline: none;
 
417
  }
418
 
419
- .ProseMirror p {
420
- margin: 1em 0;
 
 
421
  }
422
 
423
- .ProseMirror h1,
424
- .ProseMirror h2,
425
- .ProseMirror h3 {
426
- margin: 1em 0 0.5em;
427
  }
428
 
429
- /* Tag styles */
430
- .tag {
431
- display: inline-flex;
432
- align-items: center;
433
- padding: 0.25rem 0.75rem;
434
- border-radius: 9999px;
435
- font-size: 0.75rem;
436
- font-weight: 500;
437
- }
438
-
439
- .tag-blue {
440
- background-color: #dbeafe;
441
- color: #1e40af;
442
  }
443
 
444
- .dark .tag-blue {
445
- background-color: #1e3a8a;
446
- color: #dbeafe;
447
- }
448
-
449
- /* Note card styles */
450
- .note-card {
451
- transition: all 0.2s ease-in-out;
452
- }
453
-
454
- .note-card:hover {
455
- transform: translateY(-2px);
456
- box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
457
- }
458
-
459
- /* Loading animation */
460
- @keyframes spin {
461
- to { transform: rotate(360deg); }
462
  }
463
 
464
- .loading {
465
- animation: spin 1s linear infinite;
 
 
 
 
 
 
 
 
466
  }
467
  </style>
468
  <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=dataquantals/notes-taker" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>AI Assist - Quantals Collect</title>
7
  <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
8
  <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
9
+ <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
 
 
 
 
 
 
 
 
 
10
  </head>
11
+ <body class="bg-gray-50">
12
  <!-- Main Navigation -->
13
+ <nav class="bg-white shadow-sm">
14
  <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
15
  <div class="flex justify-between h-16">
16
  <div class="flex">
 
18
  <img class="h-8 w-auto" src="assets/logo.svg" alt="Quantals Collect">
19
  </div>
20
  <div class="hidden sm:ml-6 sm:flex sm:space-x-8">
21
+ <a href="Dashboard.html" class="border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">
22
  Dashboard
23
  </a>
24
+ <a href="Projects.html" class="border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">
25
  Projects
26
  </a>
27
+ <a href="Participants.html" class="border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">
28
  Participants
29
  </a>
30
+ <a href="Analysis.html" class="border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">
31
  Analysis
32
  </a>
33
+ <a href="AI_Assist.html" class="border-indigo-500 text-indigo-600 border-b-2 inline-flex items-center px-1 pt-1 text-sm font-medium">
34
+ AI Assist
 
35
  </a>
36
  </div>
37
  </div>
 
 
 
 
 
 
38
  </div>
39
  </div>
40
  </nav>
 
42
  <!-- Main Content -->
43
  <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
44
  <div class="grid grid-cols-12 gap-6">
45
+ <!-- Sidebar Task Menu -->
46
  <div class="col-span-3">
47
+ <div class="bg-white rounded-lg shadow p-4">
48
+ <h2 class="text-xl font-semibold text-gray-900 mb-4">AI Tasks</h2>
49
+ <div class="space-y-2">
50
+ <button onclick="selectTask('summarize')" class="w-full flex items-center p-3 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500">
51
+ <i class="fas fa-file-alt text-indigo-600 w-5 h-5"></i>
52
+ <span class="ml-3 text-sm font-medium text-gray-900">Summarize Interview</span>
53
+ </button>
54
+ <button onclick="selectTask('code')" class="w-full flex items-center p-3 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500">
55
+ <i class="fas fa-tags text-indigo-600 w-5 h-5"></i>
56
+ <span class="ml-3 text-sm font-medium text-gray-900">Suggest Codes</span>
57
+ </button>
58
+ <button onclick="selectTask('improve')" class="w-full flex items-center p-3 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500">
59
+ <i class="fas fa-pen text-indigo-600 w-5 h-5"></i>
60
+ <span class="ml-3 text-sm font-medium text-gray-900">Improve Field Note</span>
61
+ </button>
62
+ <button onclick="selectTask('translate')" class="w-full flex items-center p-3 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500">
63
+ <i class="fas fa-language text-indigo-600 w-5 h-5"></i>
64
+ <span class="ml-3 text-sm font-medium text-gray-900">Translate to English</span>
65
+ </button>
66
+ <button onclick="selectTask('cluster')" class="w-full flex items-center p-3 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500">
67
+ <i class="fas fa-object-group text-indigo-600 w-5 h-5"></i>
68
+ <span class="ml-3 text-sm font-medium text-gray-900">Cluster Notes</span>
69
+ </button>
70
+ <button onclick="selectTask('memo')" class="w-full flex items-center p-3 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500">
71
+ <i class="fas fa-sticky-note text-indigo-600 w-5 h-5"></i>
72
+ <span class="ml-3 text-sm font-medium text-gray-900">Generate Memo</span>
73
+ </button>
74
+ <button onclick="selectTask('custom')" class="w-full flex items-center p-3 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500">
75
+ <i class="fas fa-comment text-indigo-600 w-5 h-5"></i>
76
+ <span class="ml-3 text-sm font-medium text-gray-900">Custom Prompt</span>
77
+ </button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  </div>
79
  </div>
80
  </div>
81
 
82
+ <!-- Main Area -->
83
  <div class="col-span-9 space-y-6">
84
+ <!-- Header -->
85
+ <div class="bg-white rounded-lg shadow p-6">
86
+ <h1 class="text-2xl font-bold text-gray-900">AI Assist</h1>
87
+ <p class="mt-2 text-gray-600">Let AI help you summarize, translate, code, and cluster qualitative research data.</p>
88
+ <div class="mt-4 p-4 bg-yellow-50 rounded-md">
89
+ <div class="flex">
90
+ <div class="flex-shrink-0">
91
+ <i class="fas fa-exclamation-triangle text-yellow-400"></i>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  </div>
93
+ <div class="ml-3">
94
+ <h3 class="text-sm font-medium text-yellow-800">Warning</h3>
95
+ <p class="text-sm text-yellow-700">Always validate AI-generated content before use.</p>
 
 
96
  </div>
97
  </div>
98
  </div>
 
 
 
99
  </div>
100
 
101
+ <!-- Input Area -->
102
+ <div class="bg-white rounded-lg shadow p-6">
103
+ <div class="space-y-4">
104
+ <div>
105
+ <label class="block text-sm font-medium text-gray-700">Input Text</label>
106
+ <textarea id="inputText" rows="10" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"></textarea>
107
+ </div>
108
+ <div class="flex items-center justify-between">
109
+ <div class="flex items-center">
110
+ <input type="file" id="fileUpload" class="hidden" accept=".txt,.json">
111
+ <button onclick="document.getElementById('fileUpload').click()" class="inline-flex items-center px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
112
+ <i class="fas fa-upload mr-2"></i>
113
+ Upload File
 
114
  </button>
115
  </div>
116
+ <button id="runAI" onclick="runAI()" disabled class="inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 disabled:opacity-50 disabled:cursor-not-allowed">
117
+ <i class="fas fa-robot mr-2"></i>
118
+ Run AI
119
+ </button>
120
+ </div>
121
+ </div>
122
+ </div>
123
+
124
+ <!-- Output Area -->
125
+ <div class="bg-white rounded-lg shadow p-6">
126
+ <div class="flex justify-between items-center mb-4">
127
+ <h3 class="text-lg font-medium text-gray-900">AI Output</h3>
128
+ <div class="flex space-x-2">
129
+ <button onclick="copyToClipboard()" class="inline-flex items-center px-3 py-1.5 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
130
+ <i class="fas fa-copy mr-1"></i>
131
+ Copy
132
+ </button>
133
+ <button onclick="exportOutput()" class="inline-flex items-center px-3 py-1.5 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
134
+ <i class="fas fa-download mr-1"></i>
135
+ Export
136
+ </button>
137
  </div>
138
  </div>
139
+ <div id="output" class="prose max-w-none">
140
+ <div class="text-gray-500 text-center py-8">
141
+ <i class="fas fa-robot text-4xl mb-2"></i>
142
+ <p>AI output will appear here</p>
143
  </div>
144
  </div>
145
  </div>
 
147
  </div>
148
  </div>
149
 
150
+ <!-- Loading Overlay -->
151
+ <div id="loadingOverlay" class="hidden fixed inset-0 bg-gray-500 bg-opacity-75 flex items-center justify-center">
152
+ <div class="bg-white rounded-lg p-6 max-w-sm w-full mx-4">
153
+ <div class="flex items-center">
154
+ <div class="animate-spin rounded-full h-8 w-8 border-b-2 border-indigo-600"></div>
155
+ <p class="ml-3 text-gray-700">Processing your request...</p>
156
+ </div>
157
+ </div>
158
  </div>
159
 
160
  <!-- Scripts -->
161
  <script>
162
+ // Configuration
163
+ const API_KEY = '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';
164
+ const API_URL = 'https://openrouter.ai/api/v1/chat/completions';
165
+
166
+ // Task prompts
167
+ const TASK_PROMPTS = {
168
+ summarize: "Summarize this interview into major themes and include 2-3 key quotes for each.",
169
+ code: "Suggest qualitative research codes based on the following transcript. Group them hierarchically if possible.",
170
+ improve: "Refine this note for grammar, spelling, and clarity without changing meaning.",
171
+ translate: "Translate the following interview from a local language into English.",
172
+ cluster: "Group the following field notes into thematic clusters using semantic similarity.",
173
+ memo: "Create a theoretical memo from this field data and suggest next steps in analysis.",
174
+ custom: "Please analyze the following text:"
175
+ };
176
+
177
+ // State
178
+ let currentTask = null;
179
+ let isProcessing = false;
180
+
181
+ // UI Elements
182
+ const inputText = document.getElementById('inputText');
183
+ const runAIButton = document.getElementById('runAI');
184
+ const outputDiv = document.getElementById('output');
185
+ const loadingOverlay = document.getElementById('loadingOverlay');
186
+ const fileUpload = document.getElementById('fileUpload');
187
+
188
+ // Event Listeners
189
+ inputText.addEventListener('input', validateInput);
190
+ fileUpload.addEventListener('change', handleFileUpload);
191
+
192
+ // Functions
193
+ function selectTask(task) {
194
+ currentTask = task;
195
+ // Update UI to show selected task
196
+ document.querySelectorAll('button').forEach(btn => {
197
+ btn.classList.remove('bg-indigo-50');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  });
199
+ event.currentTarget.classList.add('bg-indigo-50');
200
  }
201
 
202
+ function validateInput() {
203
+ runAIButton.disabled = !inputText.value.trim();
 
 
204
  }
205
 
206
+ async function handleFileUpload(event) {
207
+ const file = event.target.files[0];
208
+ if (file) {
209
+ try {
210
+ const text = await file.text();
211
+ inputText.value = text;
212
+ validateInput();
213
+ } catch (error) {
214
+ showError('Error reading file');
215
+ }
216
+ }
217
+ }
218
 
219
+ async function runAI() {
220
+ if (!currentTask || !inputText.value.trim() || isProcessing) return;
221
+
222
+ isProcessing = true;
223
+ showLoading();
224
+
225
+ try {
226
+ const response = await fetch(API_URL, {
227
+ method: 'POST',
228
+ headers: {
229
+ 'Authorization': `Bearer ${API_KEY}`,
230
+ 'Content-Type': 'application/json'
231
+ },
232
+ body: JSON.stringify({
233
+ model: "deepseek-coder:52-r1",
234
+ messages: [
235
+ { role: "system", content: "You are a research assistant helping with qualitative data analysis." },
236
+ { role: "user", content: `${TASK_PROMPTS[currentTask]}\n\n${inputText.value}` }
237
+ ]
238
+ })
239
  });
 
 
240
 
241
+ if (!response.ok) {
242
+ throw new Error('API request failed');
243
+ }
244
+
245
+ const data = await response.json();
246
+ displayResult(data.choices[0].message.content);
247
+ } catch (error) {
248
+ showError('Error processing request. Please try again.');
249
+ console.error('AI processing error:', error);
250
+ } finally {
251
+ isProcessing = false;
252
+ hideLoading();
253
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
254
  }
255
 
256
+ function displayResult(content) {
257
+ outputDiv.innerHTML = marked.parse(content);
 
 
 
 
 
 
 
 
 
 
 
258
  }
259
 
260
+ function showLoading() {
261
+ loadingOverlay.classList.remove('hidden');
 
 
 
262
  }
263
 
264
+ function hideLoading() {
265
+ loadingOverlay.classList.add('hidden');
 
 
 
266
  }
267
 
268
+ function showError(message) {
269
+ outputDiv.innerHTML = `
270
+ <div class="bg-red-50 border-l-4 border-red-400 p-4">
271
+ <div class="flex">
272
+ <div class="flex-shrink-0">
273
+ <i class="fas fa-exclamation-circle text-red-400"></i>
274
+ </div>
275
+ <div class="ml-3">
276
+ <p class="text-sm text-red-700">${message}</p>
277
+ </div>
278
+ </div>
279
+ </div>
280
+ `;
281
  }
282
 
283
+ function copyToClipboard() {
284
+ const content = outputDiv.innerText;
285
+ navigator.clipboard.writeText(content).then(() => {
286
+ showToast('Copied to clipboard');
287
+ }).catch(() => {
288
+ showToast('Failed to copy');
289
+ });
290
  }
291
 
292
+ function exportOutput() {
293
+ const content = outputDiv.innerText;
294
+ const blob = new Blob([content], { type: 'text/plain' });
295
+ const url = URL.createObjectURL(blob);
296
+ const a = document.createElement('a');
297
+ a.href = url;
298
+ a.download = 'ai-assist-output.txt';
299
+ document.body.appendChild(a);
300
+ a.click();
301
+ document.body.removeChild(a);
302
+ URL.revokeObjectURL(url);
303
  }
304
 
305
+ function showToast(message) {
306
+ const toast = document.createElement('div');
307
+ toast.className = 'fixed bottom-4 right-4 bg-gray-800 text-white px-4 py-2 rounded-md shadow-lg';
308
+ toast.textContent = message;
309
+ document.body.appendChild(toast);
310
+ setTimeout(() => {
311
+ toast.remove();
312
+ }, 3000);
313
  }
314
 
315
+ // Offline detection
316
+ window.addEventListener('online', () => {
317
+ runAIButton.disabled = false;
318
+ });
319
 
320
+ window.addEventListener('offline', () => {
321
+ runAIButton.disabled = true;
322
+ showError('No internet connection');
 
323
  });
324
  </script>
325
 
326
  <!-- Styles -->
327
  <style>
328
+ .prose {
329
+ max-width: 65ch;
330
+ color: #374151;
 
 
 
 
331
  }
332
 
333
+ .prose h1 {
334
+ color: #111827;
335
+ font-weight: 800;
336
+ font-size: 2.25em;
337
+ margin-top: 0;
338
+ margin-bottom: 0.8888889em;
339
+ line-height: 1.1111111;
340
  }
341
 
342
+ .prose h2 {
343
+ color: #111827;
344
+ font-weight: 700;
345
+ font-size: 1.5em;
346
+ margin-top: 2em;
347
+ margin-bottom: 1em;
348
+ line-height: 1.3333333;
349
  }
350
 
351
+ .prose p {
352
+ margin-top: 1.25em;
353
+ margin-bottom: 1.25em;
354
  }
355
 
356
+ .prose ul {
357
+ margin-top: 1.25em;
358
+ margin-bottom: 1.25em;
359
+ padding-left: 1.625em;
360
  }
361
 
362
+ .prose li {
363
+ margin-top: 0.5em;
364
+ margin-bottom: 0.5em;
 
365
  }
366
 
367
+ .prose code {
368
+ color: #111827;
369
+ font-weight: 600;
370
+ font-size: 0.875em;
 
 
 
 
 
 
 
 
 
371
  }
372
 
373
+ .prose pre {
374
+ color: #e5e7eb;
375
+ background-color: #1f2937;
376
+ overflow-x: auto;
377
+ font-size: 0.875em;
378
+ line-height: 1.7142857;
379
+ margin-top: 1.7142857em;
380
+ margin-bottom: 1.7142857em;
381
+ border-radius: 0.375rem;
382
+ padding: 0.8571429em 1.1428571em;
 
 
 
 
 
 
 
 
383
  }
384
 
385
+ .prose blockquote {
386
+ font-weight: 500;
387
+ font-style: italic;
388
+ color: #111827;
389
+ border-left-width: 0.25rem;
390
+ border-left-color: #e5e7eb;
391
+ quotes: "\201C""\201D""\2018""\2019";
392
+ margin-top: 1.6em;
393
+ margin-bottom: 1.6em;
394
+ padding-left: 1em;
395
  }
396
  </style>
397
  <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=dataquantals/notes-taker" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>