File size: 31,980 Bytes
c190eb8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7a108c6
 
 
 
c190eb8
 
 
 
 
 
 
 
 
 
7a108c6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c190eb8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7a108c6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c190eb8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7a108c6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c190eb8
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AuraRecall | AI-Powered Memory System</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        .file-upload-container {
            transition: all 0.3s ease;
        }
        .file-upload-container:hover {
            transform: translateY(-2px);
        }
        .ai-response-container {
            max-height: 300px;
            overflow-y: auto;
        }
        .pulse-animation {
            animation: pulse 2s infinite;
        }
        .memory-object {
            background: linear-gradient(145deg, #ffffff, #f5f3ff);
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
        }
        @keyframes pulse {
            0% { opacity: 0.6; }
            50% { opacity: 1; }
            100% { opacity: 0.6; }
        }
        .gradient-border {
            border: 2px solid transparent;
            background: linear-gradient(white, white) padding-box,
                        linear-gradient(to right, #6366f1, #8b5cf6) border-box;
        }
        .processing-step {
            position: relative;
        }
        .processing-step:not(:last-child):after {
            content: "";
            position: absolute;
            right: -20px;
            top: 50%;
            transform: translateY(-50%);
            width: 0;
            height: 0;
            border-top: 10px solid transparent;
            border-bottom: 10px solid transparent;
            border-left: 10px solid #8b5cf6;
        }
    </style>
</head>
<body class="bg-gray-50 min-h-screen">
    <div class="container mx-auto px-4 py-8 max-w-6xl">
        <!-- Header -->
        <header class="mb-12 text-center">
            <div class="flex justify-center items-center mb-4">
                <div class="w-12 h-12 rounded-full bg-indigo-500 flex items-center justify-center mr-4">
                    <i class="fas fa-brain text-white text-xl"></i>
                </div>
                <h1 class="text-4xl font-bold text-indigo-800">AuraRecall</h1>
            </div>
            <h2 class="text-2xl font-semibold text-gray-700">AI-Powered Memory System with Cloudflare Integration</h2>
            <div class="w-24 h-1 bg-indigo-500 mx-auto mt-4 rounded-full"></div>
        </header>

        <!-- Main Content -->
        <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
            <!-- File Upload Section -->
            <div class="bg-white rounded-xl shadow-md overflow-hidden gradient-border">
                <div class="bg-indigo-600 px-6 py-4">
                    <h3 class="text-xl font-semibold text-white flex items-center">
                        <i class="fas fa-cloud-upload-alt mr-3"></i> Memory Fragment Upload
                    </h3>
                </div>
                <div class="p-6">
                    <div id="file-upload-container" class="file-upload-container border-2 border-dashed border-gray-300 rounded-lg p-8 text-center cursor-pointer hover:border-indigo-400 transition">
                        <i class="fas fa-file-upload text-4xl text-gray-400 mb-4"></i>
                        <p class="text-gray-600 mb-2">Drag & drop your memory fragment here</p>
                        <p class="text-sm text-gray-500 mb-4">Supports audio (MP3, WAV) and video (MP4, MOV) files</p>
                        <input type="file" id="file-input" class="hidden" accept=".mp3,.wav,.mp4,.mov">
                        <label for="file-input" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition cursor-pointer">
                            Select File
                        </label>
                    </div>
                    
                    <div id="upload-progress" class="mt-6 hidden">
                        <div class="flex justify-between mb-2">
                            <span class="text-sm font-medium text-gray-700">Uploading...</span>
                            <span id="upload-percent" class="text-sm font-medium text-indigo-600">0%</span>
                        </div>
                        <div class="w-full bg-gray-200 rounded-full h-2.5">
                            <div id="upload-progress-bar" class="bg-indigo-600 h-2.5 rounded-full" style="width: 0%"></div>
                        </div>
                    </div>
                    
                    <div id="upload-success" class="mt-6 p-4 bg-green-50 rounded-lg hidden">
                        <div class="flex items-center">
                            <i class="fas fa-check-circle text-green-500 text-xl mr-3"></i>
                            <div>
                                <h4 class="font-medium text-green-800">Upload Successful!</h4>
                                <p class="text-sm text-green-600">Your memory fragment is being processed.</p>
                            </div>
                        </div>
                    </div>
                    
                    <div id="upload-error" class="mt-6 p-4 bg-red-50 rounded-lg hidden">
                        <div class="flex items-center">
                            <i class="fas fa-exclamation-circle text-red-500 text-xl mr-3"></i>
                            <div>
                                <h4 class="font-medium text-red-800">Upload Failed</h4>
                                <p id="error-message" class="text-sm text-red-600"></p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- AI Query Section -->
            <div class="bg-white rounded-xl shadow-md overflow-hidden gradient-border">
                <div class="bg-purple-600 px-6 py-4">
                    <h3 class="text-xl font-semibold text-white flex items-center">
                        <i class="fas fa-robot mr-3"></i> Cloudflare AI Gateway
                    </h3>
                </div>
                <div class="p-6">
                    <div class="mb-6">
                        <label for="ai-query" class="block text-sm font-medium text-gray-700 mb-2">Ask about your memories</label>
                        <div class="flex">
                            <input type="text" id="ai-query" placeholder="E.g. What was that restaurant we visited in Paris?" 
                                   class="flex-1 px-4 py-2 border border-gray-300 rounded-l-lg focus:ring-indigo-500 focus:border-indigo-500">
                            <button id="send-query" class="px-4 py-2 bg-purple-600 text-white rounded-r-lg hover:bg-purple-700 transition">
                                <i class="fas fa-paper-plane"></i>
                            </button>
                        </div>
                    </div>
                    
                    <div id="ai-thinking" class="hidden mb-6 p-4 bg-purple-50 rounded-lg">
                        <div class="flex items-center">
                            <div class="pulse-animation">
                                <i class="fas fa-circle-notch fa-spin text-purple-500 mr-3"></i>
                            </div>
                            <span class="text-purple-700">Processing your query with AI...</span>
                        </div>
                    </div>
                    
                    <div id="ai-response-container" class="hidden">
                        <h4 class="font-medium text-gray-700 mb-3 flex items-center">
                            <i class="fas fa-comment-dots text-purple-500 mr-2"></i> AI Response
                        </h4>
                        <div class="ai-response-container bg-gray-50 p-4 rounded-lg border border-gray-200">
                            <p id="ai-response" class="text-gray-700"></p>
                        </div>
                        <div class="mt-3 text-right">
                            <button id="refine-query" class="text-sm px-3 py-1 bg-gray-100 text-gray-600 rounded hover:bg-gray-200 transition">
                                <i class="fas fa-redo mr-1"></i> Refine Query
                            </button>
                        </div>
                    </div>
                    
                    <div id="ai-error" class="hidden mt-6 p-4 bg-red-50 rounded-lg">
                        <div class="flex items-center">
                            <i class="fas fa-exclamation-circle text-red-500 text-xl mr-3"></i>
                            <div>
                                <h4 class="font-medium text-red-800">AI Query Failed</h4>
                                <p id="ai-error-message" class="text-sm text-red-600"></p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- AI Processing Demo Section -->
        <div class="mt-12 bg-white rounded-xl shadow-md overflow-hidden">
            <div class="bg-gradient-to-r from-indigo-600 to-purple-600 px-6 py-4">
                <h3 class="text-xl font-semibold text-white flex items-center">
                    <i class="fas fa-microchip mr-3"></i> AI Processing Demonstration
                </h3>
            </div>
            <div class="p-6">
                <p class="text-gray-600 mb-6">
                    This section demonstrates how AuraRecall processes your memory fragments to create structured memory objects.
                </p>
                
                <div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-8">
                    <div class="processing-step bg-indigo-50 p-4 rounded-lg flex flex-col items-center">
                        <div class="w-12 h-12 rounded-full bg-indigo-100 flex items-center justify-center mb-3">
                            <i class="fas fa-file-audio text-indigo-600"></i>
                        </div>
                        <h4 class="font-medium text-indigo-800 text-center">Audio Transcription</h4>
                        <p class="text-sm text-gray-600 text-center mt-1">Convert speech to text</p>
                        <div id="transcription-result" class="mt-3 text-sm text-gray-700 hidden"></div>
                    </div>
                    
                    <div class="processing-step bg-purple-50 p-4 rounded-lg flex flex-col items-center">
                        <div class="w-12 h-12 rounded-full bg-purple-100 flex items-center justify-center mb-3">
                            <i class="fas fa-image text-purple-600"></i>
                        </div>
                        <h4 class="font-medium text-purple-800 text-center">Visual Analysis</h4>
                        <p class="text-sm text-gray-600 text-center mt-1">Detect objects and faces</p>
                        <div id="visual-result" class="mt-3 text-sm text-gray-700 hidden"></div>
                    </div>
                    
                    <div class="processing-step bg-blue-50 p-4 rounded-lg flex flex-col items-center">
                        <div class="w-12 h-12 rounded-full bg-blue-100 flex items-center justify-center mb-3">
                            <i class="fas fa-link text-blue-600"></i>
                        </div>
                        <h4 class="font-medium text-blue-800 text-center">Context Linking</h4>
                        <p class="text-sm text-gray-600 text-center mt-1">Connect related elements</p>
                        <div id="linking-result" class="mt-3 text-sm text-gray-700 hidden"></div>
                    </div>
                </div>
                
                <div id="memory-object-demo" class="hidden">
                    <h4 class="font-medium text-gray-700 mb-3 flex items-center">
                        <i class="fas fa-cube text-indigo-500 mr-2"></i> Generated Memory Object
                    </h4>
                    <div class="memory-object p-4 rounded-lg border border-gray-200">
                        <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
                            <div class="bg-indigo-50 p-3 rounded">
                                <h5 class="font-medium text-indigo-700 mb-2 flex items-center">
                                    <i class="fas fa-align-left mr-2 text-sm"></i> Transcription
                                </h5>
                                <p id="memory-transcription" class="text-sm text-gray-700"></p>
                            </div>
                            <div class="bg-purple-50 p-3 rounded">
                                <h5 class="font-medium text-purple-700 mb-2 flex items-center">
                                    <i class="fas fa-tags mr-2 text-sm"></i> Detected Entities
                                </h5>
                                <div id="memory-entities" class="text-sm text-gray-700"></div>
                            </div>
                            <div class="bg-blue-50 p-3 rounded">
                                <h5 class="font-medium text-blue-700 mb-2 flex items-center">
                                    <i class="fas fa-project-diagram mr-2 text-sm"></i> Context Links
                                </h5>
                                <div id="memory-links" class="text-sm text-gray-700"></div>
                            </div>
                        </div>
                        <div class="mt-4 pt-3 border-t border-gray-200">
                            <div class="flex justify-between items-center">
                                <div class="flex items-center">
                                    <i class="fas fa-fingerprint text-gray-500 mr-2"></i>
                                    <span class="text-xs text-gray-500">Bio-signature: <span class="text-gray-700">user_authenticated</span></span>
                                </div>
                                <div class="text-xs text-gray-500">
                                    <i class="fas fa-calendar-alt mr-1"></i>
                                    <span id="memory-timestamp"></span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                
                <div class="mt-6 text-center">
                    <button id="demo-processing" class="px-4 py-2 bg-gradient-to-r from-indigo-500 to-purple-500 text-white rounded-lg hover:from-indigo-600 hover:to-purple-600 transition">
                        <i class="fas fa-play-circle mr-2"></i> Run Processing Demo
                    </button>
                </div>
            </div>
        </div>
        
        <!-- System Status -->
        <div class="mt-12 bg-white rounded-xl shadow-md overflow-hidden">
            <div class="bg-gray-800 px-6 py-4">
                <h3 class="text-xl font-semibold text-white flex items-center">
                    <i class="fas fa-server mr-3"></i> System Status
                </h3>
            </div>
            <div class="p-6">
                <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
                    <div class="border border-gray-200 rounded-lg p-4">
                        <div class="flex items-center mb-3">
                            <div class="w-10 h-10 rounded-full bg-indigo-100 flex items-center justify-center mr-3">
                                <i class="fas fa-upload text-indigo-500"></i>
                            </div>
                            <h4 class="font-medium text-gray-700">Ingestion Service</h4>
                        </div>
                        <div class="flex items-center">
                            <div class="w-2 h-2 rounded-full bg-green-500 mr-2"></div>
                            <span class="text-sm text-gray-600">Operational</span>
                        </div>
                    </div>
                    
                    <div class="border border-gray-200 rounded-lg p-4">
                        <div class="flex items-center mb-3">
                            <div class="w-10 h-10 rounded-full bg-purple-100 flex items-center justify-center mr-3">
                                <i class="fas fa-network-wired text-purple-500"></i>
                            </div>
                            <h4 class="font-medium text-gray-700">Cloudflare Gateway</h4>
                        </div>
                        <div class="flex items-center">
                            <div class="w-2 h-2 rounded-full bg-green-500 mr-2"></div>
                            <span class="text-sm text-gray-600">Connected</span>
                        </div>
                    </div>
                    
                    <div class="border border-gray-200 rounded-lg p-4">
                        <div class="flex items-center mb-3">
                            <div class="w-10 h-10 rounded-full bg-blue-100 flex items-center justify-center mr-3">
                                <i class="fas fa-database text-blue-500"></i>
                            </div>
                            <h4 class="font-medium text-gray-700">Memory Database</h4>
                        </div>
                        <div class="flex items-center">
                            <div class="w-2 h-2 rounded-full bg-green-500 mr-2"></div>
                            <span class="text-sm text-gray-600">Synced</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // File Upload Handling
            const fileInput = document.getElementById('file-input');
            const uploadContainer = document.getElementById('file-upload-container');
            const uploadProgress = document.getElementById('upload-progress');
            const progressBar = document.getElementById('upload-progress-bar');
            const uploadPercent = document.getElementById('upload-percent');
            const uploadSuccess = document.getElementById('upload-success');
            const uploadError = document.getElementById('upload-error');
            const errorMessage = document.getElementById('error-message');
            
            // Drag and drop functionality
            uploadContainer.addEventListener('dragover', (e) => {
                e.preventDefault();
                uploadContainer.classList.add('border-indigo-500', 'bg-indigo-50');
            });
            
            uploadContainer.addEventListener('dragleave', () => {
                uploadContainer.classList.remove('border-indigo-500', 'bg-indigo-50');
            });
            
            uploadContainer.addEventListener('drop', (e) => {
                e.preventDefault();
                uploadContainer.classList.remove('border-indigo-500', 'bg-indigo-50');
                if (e.dataTransfer.files.length) {
                    fileInput.files = e.dataTransfer.files;
                    handleFileUpload();
                }
            });
            
            fileInput.addEventListener('change', handleFileUpload);
            
            function handleFileUpload() {
                const file = fileInput.files[0];
                if (!file) return;
                
                // Validate file type
                const validTypes = ['audio/mp3', 'audio/wav', 'video/mp4', 'video/quicktime'];
                if (!validTypes.includes(file.type)) {
                    showUploadError('Invalid file type. Please upload an audio or video file.');
                    return;
                }
                
                // Validate file size (max 100MB)
                if (file.size > 100 * 1024 * 1024) {
                    showUploadError('File too large. Maximum size is 100MB.');
                    return;
                }
                
                // Show upload progress
                uploadProgress.classList.remove('hidden');
                uploadSuccess.classList.add('hidden');
                uploadError.classList.add('hidden');
                
                // Simulate upload progress (in a real app, this would be actual upload progress)
                let progress = 0;
                const interval = setInterval(() => {
                    progress += Math.random() * 10;
                    if (progress >= 100) {
                        progress = 100;
                        clearInterval(interval);
                        
                        // Simulate successful upload
                        setTimeout(() => {
                            uploadProgress.classList.add('hidden');
                            uploadSuccess.classList.remove('hidden');
                            
                            // Reset after 5 seconds
                            setTimeout(() => {
                                uploadSuccess.classList.add('hidden');
                                fileInput.value = '';
                            }, 5000);
                        }, 500);
                    }
                    
                    progressBar.style.width = `${progress}%`;
                    uploadPercent.textContent = `${Math.round(progress)}%`;
                }, 300);
            }
            
            function showUploadError(message) {
                errorMessage.textContent = message;
                uploadError.classList.remove('hidden');
                uploadProgress.classList.add('hidden');
                uploadSuccess.classList.add('hidden');
                
                // Hide error after 5 seconds
                setTimeout(() => {
                    uploadError.classList.add('hidden');
                }, 5000);
            }
            
            // AI Query Handling
            const aiQueryInput = document.getElementById('ai-query');
            const sendQueryBtn = document.getElementById('send-query');
            const aiThinking = document.getElementById('ai-thinking');
            const aiResponseContainer = document.getElementById('ai-response-container');
            const aiResponse = document.getElementById('ai-response');
            const aiError = document.getElementById('ai-error');
            const aiErrorMessage = document.getElementById('ai-error-message');
            const refineQueryBtn = document.getElementById('refine-query');
            
            sendQueryBtn.addEventListener('click', handleAIQuery);
            aiQueryInput.addEventListener('keypress', (e) => {
                if (e.key === 'Enter') handleAIQuery();
            });
            
            refineQueryBtn.addEventListener('click', () => {
                aiResponseContainer.classList.add('hidden');
                aiQueryInput.focus();
            });
            
            function handleAIQuery() {
                const query = aiQueryInput.value.trim();
                if (!query) return;
                
                // Show thinking indicator
                aiThinking.classList.remove('hidden');
                aiResponseContainer.classList.add('hidden');
                aiError.classList.add('hidden');
                
                // In a real app, this would be an actual API call to Cloudflare AI Gateway
                // For demo purposes, we'll simulate a response after a delay
                setTimeout(() => {
                    aiThinking.classList.add('hidden');
                    
                    // Simulate success or error randomly
                    if (Math.random() > 0.2) { // 80% chance of success
                        // Generate a plausible AI response
                        const responses = [
                            `Based on your memories, you visited a charming French bistro called "Le Petit Jardin" in Paris on June 15, 2022. The meal included duck confit and a bottle of Bordeaux wine. You mentioned the service was exceptional.`,
                            `Your memory fragments show a restaurant with red awnings and outdoor seating. The name "Chez Marie" appears in one of your photos from that trip. You were there with two friends around 7:30 PM.`,
                            `I found references to a Parisian restaurant in your audio recordings from last year. You described it as having "the best onion soup" and located near the Eiffel Tower. The receipt shows you paid €85 for three people.`
                        ];
                        
                        aiResponse.textContent = responses[Math.floor(Math.random() * responses.length)];
                        aiResponseContainer.classList.remove('hidden');
                    } else {
                        // Simulate error
                        aiErrorMessage.textContent = "Could not connect to AI service. Please try again later.";
                        aiError.classList.remove('hidden');
                    }
                }, 1500 + Math.random() * 2000); // Random delay between 1.5-3.5 seconds
            }
            
            // AI Processing Demo
            const demoProcessingBtn = document.getElementById('demo-processing');
            const transcriptionResult = document.getElementById('transcription-result');
            const visualResult = document.getElementById('visual-result');
            const linkingResult = document.getElementById('linking-result');
            const memoryObjectDemo = document.getElementById('memory-object-demo');
            const memoryTranscription = document.getElementById('memory-transcription');
            const memoryEntities = document.getElementById('memory-entities');
            const memoryLinks = document.getElementById('memory-links');
            const memoryTimestamp = document.getElementById('memory-timestamp');
            
            demoProcessingBtn.addEventListener('click', runProcessingDemo);
            
            function runProcessingDemo() {
                // Reset previous demo
                transcriptionResult.classList.add('hidden');
                visualResult.classList.add('hidden');
                linkingResult.classList.add('hidden');
                memoryObjectDemo.classList.add('hidden');
                
                // Disable button during demo
                demoProcessingBtn.disabled = true;
                demoProcessingBtn.innerHTML = '<i class="fas fa-cog fa-spin mr-2"></i> Processing...';
                
                // Simulate transcription step
                setTimeout(() => {
                    transcriptionResult.textContent = '"We had an amazing dinner at Le Petit Jardin last night. The duck confit was incredible!"';
                    transcriptionResult.classList.remove('hidden');
                    
                    // Simulate visual analysis step
                    setTimeout(() => {
                        visualResult.innerHTML = `
                            <div class="flex flex-wrap gap-1">
                                <span class="px-2 py-1 bg-purple-100 text-purple-800 text-xs rounded">Restaurant</span>
                                <span class="px-2 py-1 bg-purple-100 text-purple-800 text-xs rounded">Duck dish</span>
                                <span class="px-2 py-1 bg-purple-100 text-purple-800 text-xs rounded">Wine bottle</span>
                                <span class="px-2 py-1 bg-purple-100 text-purple-800 text-xs rounded">2 people</span>
                            </div>
                        `;
                        visualResult.classList.remove('hidden');
                        
                        // Simulate context linking step
                        setTimeout(() => {
                            linkingResult.innerHTML = `
                                <div class="text-center">
                                    <div class="inline-block px-3 py-1 bg-blue-100 text-blue-800 text-xs rounded-full">
                                        <i class="fas fa-link mr-1"></i> Matched location
                                    </div>
                                    <div class="mt-1 text-xs">Paris, France</div>
                                </div>
                            `;
                            linkingResult.classList.remove('hidden');
                            
                            // Show final memory object
                            setTimeout(() => {
                                memoryTranscription.textContent = '"We had an amazing dinner at Le Petit Jardin last night. The duck confit was incredible!"';
                                memoryEntities.innerHTML = `
                                    <div class="flex flex-wrap gap-1">
                                        <span class="px-2 py-1 bg-purple-100 text-purple-800 text-xs rounded">Restaurant</span>
                                        <span class="px-2 py-1 bg-purple-100 text-purple-800 text-xs rounded">Duck dish</span>
                                        <span class="px-2 py-1 bg-purple-100 text-purple-800 text-xs rounded">Wine bottle</span>
                                        <span class="px-2 py-1 bg-purple-100 text-purple-800 text-xs rounded">2 people</span>
                                    </div>
                                `;
                                memoryLinks.innerHTML = `
                                    <div class="space-y-1">
                                        <div class="flex items-center">
                                            <i class="fas fa-map-marker-alt text-blue-500 mr-2 text-xs"></i>
                                            <span class="text-xs">Le Petit Jardin, Paris</span>
                                        </div>
                                        <div class="flex items-center">
                                            <i class="fas fa-utensils text-blue-500 mr-2 text-xs"></i>
                                            <span class="text-xs">Duck confit mentioned in audio</span>
                                        </div>
                                        <div class="flex items-center">
                                            <i class="fas fa-user-friends text-blue-500 mr-2 text-xs"></i>
                                            <span class="text-xs">Dining companion: Sarah</span>
                                        </div>
                                    </div>
                                `;
                                memoryTimestamp.textContent = new Date().toLocaleDateString() + ' ' + new Date().toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'});
                                memoryObjectDemo.classList.remove('hidden');
                                
                                // Re-enable button
                                demoProcessingBtn.disabled = false;
                                demoProcessingBtn.innerHTML = '<i class="fas fa-play-circle mr-2"></i> Run Processing Demo';
                            }, 800);
                        }, 800);
                    }, 800);
                }, 800);
            }
        });
    </script>
<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=privateuserh/aurarecall1" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>