dataquantals commited on
Commit
49b63d2
·
verified ·
1 Parent(s): 79e77c3

- Initial Deployment

Browse files
Files changed (1) hide show
  1. index.html +304 -268
index.html CHANGED
@@ -3,144 +3,211 @@
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://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.0.0/css/all.min.css" rel="stylesheet">
9
- <link href="https://cdn.jsdelivr.net/npm/quill@1.3.7/dist/quill.snow.css" rel="stylesheet">
 
 
 
 
10
  <style>
11
- .note-editor {
12
- height: calc(100vh - 200px);
13
- }
14
- .ql-editor {
15
- min-height: 200px;
16
- font-size: 16px;
17
- }
18
- .note-sidebar {
19
- height: calc(100vh - 64px);
20
- overflow-y: auto;
21
- }
22
- .note-card {
23
  transition: all 0.3s ease;
24
  }
25
- .note-card:hover {
26
- transform: translateY(-2px);
27
- box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
28
- }
29
- .tag {
30
  transition: all 0.2s ease;
31
  }
32
- .tag:hover {
33
- background-color: #e2e8f0;
34
  }
35
- .breadcrumb-item {
36
- color: #4a5568;
 
 
37
  }
38
- .breadcrumb-item:hover {
39
- color: #2d3748;
 
40
  }
41
- .sync-status {
42
- transition: all 0.3s ease;
 
 
 
 
 
 
 
 
 
 
43
  }
44
  </style>
45
  </head>
46
  <body class="bg-gray-50">
47
- <!-- Navigation -->
48
- <nav class="bg-white shadow-sm">
49
- <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
50
- <div class="flex justify-between h-16">
51
- <div class="flex">
52
- <div class="flex-shrink-0 flex items-center">
53
- <img class="h-8 w-auto" src="logo-blue-3.png.png" alt="Quantals Collect">
54
- </div>
55
- <div class="hidden sm:ml-6 sm:flex sm:space-x-8">
56
- <a href="index.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">
57
- Home
58
- </a>
59
- <a href="Interviews.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">
60
- Interviews
61
- </a>
62
- <a href="Notes.html" class="border-indigo-500 text-indigo-600 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">
63
- Notes
64
- </a>
65
- </div>
66
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  </div>
68
  </div>
69
- </nav>
70
 
71
- <!-- Main Content -->
72
- <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
73
- <div class="flex flex-col md:flex-row gap-6">
74
- <!-- Sidebar -->
75
- <div class="w-full md:w-1/4 bg-white rounded-lg shadow-sm p-4 note-sidebar">
76
- <div class="flex justify-between items-center mb-4">
77
- <h2 class="text-lg font-semibold text-gray-900">Notes</h2>
78
- <button id="new-note-btn" class="bg-indigo-600 text-white px-3 py-1 rounded-md text-sm hover:bg-indigo-700">
79
- <i class="fas fa-plus mr-1"></i> New
80
- </button>
81
- </div>
82
-
83
- <!-- Search -->
84
- <div class="mb-4">
85
- <input type="text" id="note-search" placeholder="Search notes..."
86
- class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500">
87
  </div>
 
88
 
89
- <!-- Filters -->
90
- <div class="mb-4">
91
- <select id="note-type-filter" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500">
92
- <option value="all">All Types</option>
93
- <option value="observation">Observations</option>
94
- <option value="memo">Memos</option>
95
- <option value="theory">Theoretical</option>
96
- </select>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  </div>
98
 
99
- <!-- Notes List -->
100
- <div id="notes-list" class="space-y-3">
101
- <!-- Note cards will be dynamically inserted here -->
102
- </div>
103
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
104
 
105
- <!-- Editor Section -->
106
- <div class="w-full md:w-3/4 bg-white rounded-lg shadow-sm p-4">
107
- <!-- Breadcrumb -->
108
- <div class="flex items-center space-x-2 text-sm mb-4">
109
- <span class="breadcrumb-item">Project</span>
110
- <i class="fas fa-chevron-right text-gray-400"></i>
111
- <span class="breadcrumb-item">Current Note</span>
112
- </div>
 
 
 
 
 
 
113
 
114
- <!-- Editor Toolbar -->
115
- <div class="flex justify-between items-center mb-4">
116
- <div class="flex space-x-2">
117
- <button id="link-participant" class="px-3 py-1 text-sm text-gray-600 hover:bg-gray-100 rounded-md">
118
- <i class="fas fa-user-plus mr-1"></i> Link Participant
119
- </button>
120
- <button id="link-interview" class="px-3 py-1 text-sm text-gray-600 hover:bg-gray-100 rounded-md">
121
- <i class="fas fa-microphone mr-1"></i> Link Interview
122
- </button>
123
- <button id="link-code" class="px-3 py-1 text-sm text-gray-600 hover:bg-gray-100 rounded-md">
124
- <i class="fas fa-tag mr-1"></i> Link Code
125
- </button>
126
- </div>
127
- <div class="flex items-center space-x-2">
128
- <span id="sync-status" class="text-sm text-gray-500">
129
- <i class="fas fa-check-circle text-green-500"></i> Synced
130
- </span>
131
- <button id="export-note" class="px-3 py-1 text-sm text-gray-600 hover:bg-gray-100 rounded-md">
132
- <i class="fas fa-download mr-1"></i> Export
133
- </button>
134
  </div>
135
- </div>
136
-
137
- <!-- Rich Text Editor -->
138
- <div id="editor" class="note-editor"></div>
139
 
140
- <!-- Tags Section -->
141
- <div class="mt-4">
142
- <div class="flex flex-wrap gap-2" id="note-tags">
143
- <!-- Tags will be dynamically inserted here -->
 
 
 
144
  </div>
145
  </div>
146
  </div>
@@ -148,184 +215,153 @@
148
  </div>
149
 
150
  <!-- Scripts -->
151
- <script src="https://cdn.jsdelivr.net/npm/quill@1.3.7/dist/quill.min.js"></script>
152
- <script src="https://cdn.jsdelivr.net/npm/lunr@2.3.9/lunr.min.js"></script>
153
  <script>
154
- // Initialize Quill editor
155
- const quill = new Quill('#editor', {
156
- theme: 'snow',
157
- modules: {
158
- toolbar: [
159
- [{ 'header': [1, 2, 3, false] }],
160
- ['bold', 'italic', 'underline', 'strike'],
161
- [{ 'list': 'ordered'}, { 'list': 'bullet' }],
162
- ['link', 'image', 'code-block'],
163
- ['clean']
164
- ]
165
- }
166
  });
167
 
168
- // Note data structure
169
- class ResearchNote {
170
- constructor(id, content, type, linkedTo = {}) {
171
- this.id = id;
172
- this.content = content;
173
- this.type = type;
174
- this.linkedTo = linkedTo;
175
- this.createdAt = new Date().toISOString();
176
- this.lastEdited = new Date().toISOString();
177
- this.versionHistory = [];
178
- }
179
- }
180
 
181
- // Initialize IndexedDB
182
- const dbName = 'quantalsNotes';
183
- const dbVersion = 1;
184
- let db;
185
 
186
- const request = indexedDB.open(dbName, dbVersion);
 
 
 
 
 
 
 
187
 
188
- request.onerror = (event) => {
189
- console.error('Database error:', event.target.error);
190
- };
 
191
 
192
- request.onupgradeneeded = (event) => {
193
- const db = event.target.result;
194
- if (!db.objectStoreNames.contains('notes')) {
195
- const store = db.createObjectStore('notes', { keyPath: 'id' });
196
- store.createIndex('type', 'type', { unique: false });
197
- store.createIndex('createdAt', 'createdAt', { unique: false });
 
 
 
198
  }
199
- };
200
-
201
- request.onsuccess = (event) => {
202
- db = event.target.result;
203
- loadNotes();
204
- };
205
 
206
- // Load notes from IndexedDB
207
- function loadNotes() {
208
- const transaction = db.transaction(['notes'], 'readonly');
209
- const store = transaction.objectStore('notes');
210
- const request = store.getAll();
211
 
212
- request.onsuccess = () => {
213
- const notes = request.result;
214
- displayNotes(notes);
215
- };
216
- }
217
 
218
- // Display notes in the sidebar
219
- function displayNotes(notes) {
220
- const notesList = document.getElementById('notes-list');
221
- notesList.innerHTML = '';
 
 
 
 
 
 
 
 
 
 
 
222
 
223
- notes.forEach(note => {
224
- const noteCard = document.createElement('div');
225
- noteCard.className = 'note-card bg-white border border-gray-200 rounded-lg p-3 cursor-pointer';
226
- noteCard.innerHTML = `
227
- <div class="flex justify-between items-start">
228
- <h3 class="font-medium text-gray-900">${note.type}</h3>
229
- <span class="text-xs text-gray-500">${new Date(note.createdAt).toLocaleDateString()}</span>
230
- </div>
231
- <p class="text-sm text-gray-600 mt-2 line-clamp-2">${note.content}</p>
232
- <div class="flex flex-wrap gap-1 mt-2">
233
- ${note.linkedTo.participants?.map(p =>
234
- `<span class="tag bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded">${p}</span>`
235
- ).join('') || ''}
236
- </div>
237
- `;
238
- noteCard.onclick = () => loadNote(note);
239
- notesList.appendChild(noteCard);
240
- });
241
- }
242
 
243
- // Load a specific note into the editor
244
- function loadNote(note) {
245
- quill.root.innerHTML = note.content;
246
- updateBreadcrumb(note);
247
- updateTags(note);
248
- }
249
 
250
- // Update breadcrumb navigation
251
- function updateBreadcrumb(note) {
252
- const breadcrumb = document.querySelector('.breadcrumb-item:last-child');
253
- breadcrumb.textContent = `${note.type}: ${note.id}`;
254
- }
255
 
256
- // Update tags display
257
- function updateTags(note) {
258
- const tagsContainer = document.getElementById('note-tags');
259
- tagsContainer.innerHTML = '';
260
-
261
- if (note.linkedTo.participants) {
262
- note.linkedTo.participants.forEach(participant => {
263
- const tag = document.createElement('span');
264
- tag.className = 'tag bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded';
265
- tag.textContent = participant;
266
- tagsContainer.appendChild(tag);
267
- });
268
  }
269
- }
270
-
271
- // Save note to IndexedDB
272
- function saveNote(note) {
273
- const transaction = db.transaction(['notes'], 'readwrite');
274
- const store = transaction.objectStore('notes');
275
- store.put(note);
276
- }
277
-
278
- // Event Listeners
279
- document.getElementById('new-note-btn').addEventListener('click', () => {
280
- const newNote = new ResearchNote(
281
- Date.now().toString(),
282
- '',
283
- 'observation'
284
- );
285
- loadNote(newNote);
286
- saveNote(newNote);
287
  });
288
 
289
- // Auto-save functionality
290
- let autoSaveTimeout;
291
- quill.on('text-change', () => {
292
- clearTimeout(autoSaveTimeout);
293
- autoSaveTimeout = setTimeout(() => {
294
- const content = quill.root.innerHTML;
295
- // Update the current note and save
296
- // This would need to be connected to the currently loaded note
297
- }, 1000);
 
 
298
  });
299
 
300
- // Initialize search functionality
301
- const searchInput = document.getElementById('note-search');
302
- searchInput.addEventListener('input', (e) => {
303
- const searchTerm = e.target.value.toLowerCase();
304
- const transaction = db.transaction(['notes'], 'readonly');
305
- const store = transaction.objectStore('notes');
306
- const request = store.getAll();
307
-
308
- request.onsuccess = () => {
309
- const notes = request.result;
310
- const filteredNotes = notes.filter(note =>
311
- note.content.toLowerCase().includes(searchTerm) ||
312
- note.type.toLowerCase().includes(searchTerm)
313
- );
314
- displayNotes(filteredNotes);
315
- };
316
  });
317
 
318
- // Initialize type filter
319
- document.getElementById('note-type-filter').addEventListener('change', (e) => {
320
- const type = e.target.value;
321
- const transaction = db.transaction(['notes'], 'readonly');
322
- const store = transaction.objectStore('notes');
323
- const request = type === 'all' ? store.getAll() : store.index('type').getAll(type);
324
 
325
- request.onsuccess = () => {
326
- displayNotes(request.result);
327
- };
 
 
 
 
 
328
  });
 
 
 
329
  </script>
330
  <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://deepsite.hf.co/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://deepsite.hf.co" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://deepsite.hf.co?remix=dataquantals/transcriber" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
331
  </html>
 
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
+ <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
+ <!-- CodeMirror for better text editing -->
10
+ <link href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/codemirror.min.css" rel="stylesheet">
11
+ <link href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/theme/monokai.min.css" rel="stylesheet">
12
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/codemirror.min.js"></script>
13
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/mode/markdown/markdown.min.js"></script>
14
  <style>
15
+ .sidebar {
 
 
 
 
 
 
 
 
 
 
 
16
  transition: all 0.3s ease;
17
  }
18
+ .task-item {
 
 
 
 
19
  transition: all 0.2s ease;
20
  }
21
+ .task-item:hover {
22
+ background-color: rgba(99, 102, 241, 0.1);
23
  }
24
+ .CodeMirror {
25
+ height: 300px;
26
+ border: 1px solid #e5e7eb;
27
+ border-radius: 0.5rem;
28
  }
29
+ .loading-dots::after {
30
+ content: '...';
31
+ animation: dots 1.5s steps(5, end) infinite;
32
  }
33
+ @keyframes dots {
34
+ 0%, 20% { content: '.'; }
35
+ 40% { content: '..'; }
36
+ 60% { content: '...'; }
37
+ 80%, 100% { content: ''; }
38
+ }
39
+ .fade-in {
40
+ animation: fadeIn 0.3s ease-in;
41
+ }
42
+ @keyframes fadeIn {
43
+ from { opacity: 0; }
44
+ to { opacity: 1; }
45
  }
46
  </style>
47
  </head>
48
  <body class="bg-gray-50">
49
+ <div class="flex h-screen overflow-hidden">
50
+ <!-- Sidebar -->
51
+ <div class="sidebar bg-indigo-800 text-white w-64 flex flex-col">
52
+ <div class="p-4 flex items-center space-x-3 border-b border-indigo-700">
53
+ <div class="bg-white p-2 rounded-lg">
54
+ <i class="fas fa-microscope text-indigo-800 text-xl"></i>
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  </div>
56
+ <h1 class="text-xl font-bold">Quantals Collect</h1>
57
+ </div>
58
+
59
+ <nav class="flex-1 p-4 space-y-2">
60
+ <a href="dashboard.html" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white">
61
+ <i class="fas fa-home"></i>
62
+ <span>Dashboard</span>
63
+ </a>
64
+ <a href="projects.html" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white">
65
+ <i class="fas fa-project-diagram"></i>
66
+ <span>Projects</span>
67
+ </a>
68
+ <a href="participants.html" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white">
69
+ <i class="fas fa-users"></i>
70
+ <span>Participants</span>
71
+ </a>
72
+ <a href="interviews.html" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white">
73
+ <i class="fas fa-microphone"></i>
74
+ <span>Interviews</span>
75
+ </a>
76
+ <a href="notes.html" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white">
77
+ <i class="fas fa-sticky-note"></i>
78
+ <span>Notes</span>
79
+ </a>
80
+ <a href="analysis.html" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white">
81
+ <i class="fas fa-chart-pie"></i>
82
+ <span>Analysis</span>
83
+ </a>
84
+ <a href="ai-assist.html" class="flex items-center space-x-3 p-2 rounded-lg bg-indigo-700 text-white">
85
+ <i class="fas fa-robot"></i>
86
+ <span>AI Assist</span>
87
+ </a>
88
+ <a href="transcriber.html" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white">
89
+ <i class="fas fa-keyboard"></i>
90
+ <span>Transcriber</span>
91
+ </a>
92
+ </nav>
93
+
94
+ <div class="p-4 border-t border-indigo-700">
95
+ <a href="settings.html" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white">
96
+ <i class="fas fa-cog"></i>
97
+ <span>Settings</span>
98
+ </a>
99
  </div>
100
  </div>
 
101
 
102
+ <!-- Main Content Area -->
103
+ <div class="flex-1 flex flex-col overflow-hidden">
104
+ <!-- Header -->
105
+ <header class="bg-white shadow-sm p-4">
106
+ <div class="max-w-7xl mx-auto">
107
+ <h1 class="text-2xl font-bold text-gray-900">AI Assist</h1>
108
+ <p class="mt-1 text-sm text-gray-600">
109
+ Let AI help you summarize, translate, code, and cluster qualitative research data.
110
+ </p>
 
 
 
 
 
 
 
111
  </div>
112
+ </header>
113
 
114
+ <!-- Main Content -->
115
+ <div class="flex-1 flex overflow-hidden">
116
+ <!-- Task Menu -->
117
+ <div class="w-64 border-r border-gray-200 bg-white overflow-y-auto">
118
+ <div class="p-4">
119
+ <h2 class="text-lg font-semibold text-gray-800 mb-4">AI Tasks</h2>
120
+ <div class="space-y-2" id="task-list">
121
+ <button class="task-item w-full flex items-center space-x-3 p-3 rounded-lg text-left hover:bg-indigo-50" data-task="summarize">
122
+ <i class="fas fa-file-alt text-indigo-600"></i>
123
+ <span>Summarize Interview</span>
124
+ </button>
125
+ <button class="task-item w-full flex items-center space-x-3 p-3 rounded-lg text-left hover:bg-indigo-50" data-task="code">
126
+ <i class="fas fa-tags text-indigo-600"></i>
127
+ <span>Suggest Codes</span>
128
+ </button>
129
+ <button class="task-item w-full flex items-center space-x-3 p-3 rounded-lg text-left hover:bg-indigo-50" data-task="improve">
130
+ <i class="fas fa-pen-fancy text-indigo-600"></i>
131
+ <span>Improve Field Note</span>
132
+ </button>
133
+ <button class="task-item w-full flex items-center space-x-3 p-3 rounded-lg text-left hover:bg-indigo-50" data-task="translate">
134
+ <i class="fas fa-language text-indigo-600"></i>
135
+ <span>Translate to English</span>
136
+ </button>
137
+ <button class="task-item w-full flex items-center space-x-3 p-3 rounded-lg text-left hover:bg-indigo-50" data-task="cluster">
138
+ <i class="fas fa-object-group text-indigo-600"></i>
139
+ <span>Cluster Notes</span>
140
+ </button>
141
+ <button class="task-item w-full flex items-center space-x-3 p-3 rounded-lg text-left hover:bg-indigo-50" data-task="memo">
142
+ <i class="fas fa-file-medical text-indigo-600"></i>
143
+ <span>Generate Memo</span>
144
+ </button>
145
+ <button class="task-item w-full flex items-center space-x-3 p-3 rounded-lg text-left hover:bg-indigo-50" data-task="custom">
146
+ <i class="fas fa-comment-dots text-indigo-600"></i>
147
+ <span>Custom Prompt</span>
148
+ </button>
149
+ </div>
150
+ </div>
151
  </div>
152
 
153
+ <!-- Workspace -->
154
+ <div class="flex-1 flex flex-col overflow-hidden">
155
+ <div class="flex-1 p-4 overflow-y-auto">
156
+ <div class="max-w-4xl mx-auto">
157
+ <!-- Warning Banner -->
158
+ <div class="bg-yellow-50 border-l-4 border-yellow-400 p-4 mb-4">
159
+ <div class="flex">
160
+ <div class="flex-shrink-0">
161
+ <i class="fas fa-exclamation-triangle text-yellow-400"></i>
162
+ </div>
163
+ <div class="ml-3">
164
+ <p class="text-sm text-yellow-700">
165
+ Warning: Always validate AI-generated content before use.
166
+ </p>
167
+ </div>
168
+ </div>
169
+ </div>
170
 
171
+ <!-- Input Section -->
172
+ <div class="bg-white rounded-lg shadow-sm p-4 mb-4">
173
+ <div class="flex justify-between items-center mb-4">
174
+ <h3 class="text-lg font-semibold text-gray-800">Input</h3>
175
+ <div class="flex items-center space-x-2">
176
+ <label class="inline-flex items-center px-3 py-2 border border-gray-300 rounded-lg cursor-pointer hover:bg-gray-50">
177
+ <input type="file" class="hidden" id="file-upload" accept=".txt,.json">
178
+ <i class="fas fa-upload mr-2"></i>
179
+ <span>Upload File</span>
180
+ </label>
181
+ </div>
182
+ </div>
183
+ <textarea id="input-text" class="w-full h-64 p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"></textarea>
184
+ </div>
185
 
186
+ <!-- Output Section -->
187
+ <div class="bg-white rounded-lg shadow-sm p-4">
188
+ <div class="flex justify-between items-center mb-4">
189
+ <h3 class="text-lg font-semibold text-gray-800">Output</h3>
190
+ <div class="flex items-center space-x-2">
191
+ <button id="copy-output" class="px-3 py-2 text-sm text-gray-600 hover:bg-gray-100 rounded-lg">
192
+ <i class="fas fa-copy mr-2"></i>Copy
193
+ </button>
194
+ <button id="download-output" class="px-3 py-2 text-sm text-gray-600 hover:bg-gray-100 rounded-lg">
195
+ <i class="fas fa-download mr-2"></i>Download
196
+ </button>
197
+ </div>
198
+ </div>
199
+ <div id="output-text" class="w-full min-h-64 p-3 border border-gray-300 rounded-lg bg-gray-50"></div>
200
+ </div>
201
+ </div>
 
 
 
 
202
  </div>
 
 
 
 
203
 
204
+ <!-- Action Bar -->
205
+ <div class="border-t border-gray-200 bg-white p-4">
206
+ <div class="max-w-4xl mx-auto flex justify-end">
207
+ <button id="run-ai" class="px-6 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 disabled:opacity-50 disabled:cursor-not-allowed">
208
+ <i class="fas fa-robot mr-2"></i>Run AI
209
+ </button>
210
+ </div>
211
  </div>
212
  </div>
213
  </div>
 
215
  </div>
216
 
217
  <!-- Scripts -->
 
 
218
  <script>
219
+ // Initialize CodeMirror
220
+ const editor = CodeMirror.fromTextArea(document.getElementById('input-text'), {
221
+ mode: 'markdown',
222
+ theme: 'monokai',
223
+ lineNumbers: true,
224
+ lineWrapping: true
 
 
 
 
 
 
225
  });
226
 
227
+ // Task prompts
228
+ const taskPrompts = {
229
+ summarize: "Summarize this interview into major themes and include 2-3 key quotes for each.",
230
+ code: "Suggest qualitative research codes based on the following transcript. Group them hierarchically if possible.",
231
+ improve: "Refine this note for grammar, spelling, and clarity without changing meaning.",
232
+ translate: "Translate the following interview from a local language into English.",
233
+ cluster: "Group the following field notes into thematic clusters using semantic similarity.",
234
+ memo: "Create a theoretical memo from this field data and suggest next steps in analysis.",
235
+ custom: "Please analyze the following text:"
236
+ };
 
 
237
 
238
+ // Current task
239
+ let currentTask = 'summarize';
 
 
240
 
241
+ // Initialize task selection
242
+ document.querySelectorAll('.task-item').forEach(button => {
243
+ button.addEventListener('click', () => {
244
+ // Update active state
245
+ document.querySelectorAll('.task-item').forEach(btn => {
246
+ btn.classList.remove('bg-indigo-50');
247
+ });
248
+ button.classList.add('bg-indigo-50');
249
 
250
+ // Update current task
251
+ currentTask = button.dataset.task;
252
+ });
253
+ });
254
 
255
+ // Handle file upload
256
+ document.getElementById('file-upload').addEventListener('change', (e) => {
257
+ const file = e.target.files[0];
258
+ if (file) {
259
+ const reader = new FileReader();
260
+ reader.onload = (e) => {
261
+ editor.setValue(e.target.result);
262
+ };
263
+ reader.readAsText(file);
264
  }
265
+ });
 
 
 
 
 
266
 
267
+ // Handle Run AI button
268
+ document.getElementById('run-ai').addEventListener('click', async () => {
269
+ const input = editor.getValue();
270
+ if (!input.trim()) return;
 
271
 
272
+ // Show loading state
273
+ const runButton = document.getElementById('run-ai');
274
+ const originalText = runButton.innerHTML;
275
+ runButton.innerHTML = '<i class="fas fa-spinner fa-spin mr-2"></i>Processing';
276
+ runButton.disabled = true;
277
 
278
+ try {
279
+ const response = await fetch("https://openrouter.ai/api/v1/chat/completions", {
280
+ method: "POST",
281
+ headers: {
282
+ "Authorization": "Bearer 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",
283
+ "Content-Type": "application/json"
284
+ },
285
+ body: JSON.stringify({
286
+ model: "deepseek-coder:52-r1",
287
+ messages: [
288
+ { role: "system", content: "You are a research assistant helping with qualitative data analysis." },
289
+ { role: "user", content: taskPrompts[currentTask] + "\n\n" + input }
290
+ ]
291
+ })
292
+ });
293
 
294
+ if (!response.ok) {
295
+ throw new Error('Network response was not ok');
296
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
297
 
298
+ const data = await response.json();
299
+ const result = data.choices[0].message.content;
 
 
 
 
300
 
301
+ // Display result
302
+ const outputElement = document.getElementById('output-text');
303
+ outputElement.innerHTML = result;
304
+ outputElement.classList.add('fade-in');
 
305
 
306
+ } catch (error) {
307
+ console.error('Error:', error);
308
+ document.getElementById('output-text').innerHTML = `
309
+ <div class="text-red-600">
310
+ <i class="fas fa-exclamation-circle mr-2"></i>
311
+ Error: ${error.message}
312
+ </div>
313
+ `;
314
+ } finally {
315
+ // Reset button state
316
+ runButton.innerHTML = originalText;
317
+ runButton.disabled = false;
318
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
319
  });
320
 
321
+ // Handle copy output
322
+ document.getElementById('copy-output').addEventListener('click', () => {
323
+ const output = document.getElementById('output-text').innerText;
324
+ navigator.clipboard.writeText(output).then(() => {
325
+ const button = document.getElementById('copy-output');
326
+ const originalText = button.innerHTML;
327
+ button.innerHTML = '<i class="fas fa-check mr-2"></i>Copied!';
328
+ setTimeout(() => {
329
+ button.innerHTML = originalText;
330
+ }, 2000);
331
+ });
332
  });
333
 
334
+ // Handle download output
335
+ document.getElementById('download-output').addEventListener('click', () => {
336
+ const output = document.getElementById('output-text').innerText;
337
+ const blob = new Blob([output], { type: 'text/plain' });
338
+ const url = window.URL.createObjectURL(blob);
339
+ const a = document.createElement('a');
340
+ a.href = url;
341
+ a.download = `ai-assist-output-${new Date().toISOString()}.txt`;
342
+ document.body.appendChild(a);
343
+ a.click();
344
+ window.URL.revokeObjectURL(url);
345
+ document.body.removeChild(a);
 
 
 
 
346
  });
347
 
348
+ // Check online status
349
+ window.addEventListener('online', () => {
350
+ document.getElementById('run-ai').disabled = false;
351
+ });
 
 
352
 
353
+ window.addEventListener('offline', () => {
354
+ document.getElementById('run-ai').disabled = true;
355
+ document.getElementById('output-text').innerHTML = `
356
+ <div class="text-red-600">
357
+ <i class="fas fa-wifi-slash mr-2"></i>
358
+ No internet connection. Please check your network.
359
+ </div>
360
+ `;
361
  });
362
+
363
+ // Initialize
364
+ document.querySelector('.task-item').click();
365
  </script>
366
  <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://deepsite.hf.co/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://deepsite.hf.co" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://deepsite.hf.co?remix=dataquantals/transcriber" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
367
  </html>