privateuserh commited on
Commit
844bf36
·
verified ·
1 Parent(s): 78d264c

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +6 -4
  2. index.html +725 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Ai Avatar Agent V1 0
3
- emoji: 🏆
4
  colorFrom: gray
5
- colorTo: blue
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: ai-avatar-agent-v1-0
3
+ emoji: 🐳
4
  colorFrom: gray
5
+ colorTo: yellow
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,725 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>AI Video Avatar - Your Digital Guide</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
11
+
12
+ :root {
13
+ --primary: #3b82f6;
14
+ --primary-dark: #2563eb;
15
+ --secondary: #f43f5e;
16
+ }
17
+
18
+ body {
19
+ font-family: 'Poppins', sans-serif;
20
+ background: #0f172a;
21
+ color: white;
22
+ overflow: hidden;
23
+ height: 100vh;
24
+ }
25
+
26
+ .video-container {
27
+ position: fixed;
28
+ top: 0;
29
+ left: 0;
30
+ width: 100%;
31
+ height: 100%;
32
+ z-index: 0;
33
+ overflow: hidden;
34
+ }
35
+
36
+ .video-placeholder {
37
+ position: absolute;
38
+ top: 0;
39
+ left: 0;
40
+ width: 100%;
41
+ height: 100%;
42
+ object-fit: cover;
43
+ background-color: #1e293b;
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ }
48
+
49
+ .video-placeholder img {
50
+ max-width: 100%;
51
+ max-height: 100%;
52
+ object-fit: contain;
53
+ }
54
+
55
+ .video-overlay {
56
+ position: absolute;
57
+ top: 0;
58
+ left: 0;
59
+ width: 100%;
60
+ height: 100%;
61
+ background: linear-gradient(to bottom, rgba(15, 23, 42, 0.2) 0%, rgba(15, 23, 42, 0.7) 100%);
62
+ z-index: 1;
63
+ }
64
+
65
+ .content-container {
66
+ position: relative;
67
+ z-index: 2;
68
+ height: 100vh;
69
+ display: flex;
70
+ flex-direction: column;
71
+ justify-content: flex-end;
72
+ padding-bottom: 120px;
73
+ }
74
+
75
+ .speech-bubble {
76
+ position: relative;
77
+ background: rgba(30, 41, 59, 0.9);
78
+ border-radius: 1rem;
79
+ animation: pulse 2s infinite;
80
+ max-width: 800px;
81
+ margin: 0 auto;
82
+ }
83
+
84
+ .speech-bubble:after {
85
+ content: '';
86
+ position: absolute;
87
+ bottom: -10px;
88
+ left: 50px;
89
+ border-width: 10px 10px 0;
90
+ border-style: solid;
91
+ border-color: rgba(30, 41, 59, 0.9) transparent;
92
+ }
93
+
94
+ @keyframes pulse {
95
+ 0% {
96
+ box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
97
+ }
98
+ 70% {
99
+ box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
100
+ }
101
+ 100% {
102
+ box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
103
+ }
104
+ }
105
+
106
+ .typing-indicator span {
107
+ display: inline-block;
108
+ width: 8px;
109
+ height: 8px;
110
+ border-radius: 50%;
111
+ background: white;
112
+ margin: 0 2px;
113
+ opacity: 0.4;
114
+ }
115
+
116
+ .typing-indicator span:nth-child(1) {
117
+ animation: typing 1s infinite;
118
+ }
119
+
120
+ .typing-indicator span:nth-child(2) {
121
+ animation: typing 1s infinite 0.2s;
122
+ }
123
+
124
+ .typing-indicator span:nth-child(3) {
125
+ animation: typing 1s infinite 0.4s;
126
+ }
127
+
128
+ @keyframes typing {
129
+ 0% {
130
+ opacity: 0.4;
131
+ transform: translateY(0);
132
+ }
133
+ 50% {
134
+ opacity: 1;
135
+ transform: translateY(-5px);
136
+ }
137
+ 100% {
138
+ opacity: 0.4;
139
+ transform: translateY(0);
140
+ }
141
+ }
142
+
143
+ .lip-sync {
144
+ animation: lip-sync 0.5s infinite alternate;
145
+ }
146
+
147
+ @keyframes lip-sync {
148
+ 0% {
149
+ transform: scaleY(1);
150
+ }
151
+ 100% {
152
+ transform: scaleY(0.8);
153
+ }
154
+ }
155
+
156
+ .news-card {
157
+ background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.9) 100%);
158
+ backdrop-filter: blur(10px);
159
+ transition: all 0.3s ease;
160
+ }
161
+
162
+ .news-card:hover {
163
+ transform: translateY(-5px);
164
+ box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
165
+ }
166
+
167
+ .social-icon {
168
+ transition: all 0.3s ease;
169
+ }
170
+
171
+ .social-icon:hover {
172
+ transform: scale(1.2);
173
+ }
174
+
175
+ .upload-btn {
176
+ position: absolute;
177
+ top: 20px;
178
+ right: 20px;
179
+ z-index: 10;
180
+ background: rgba(30, 41, 59, 0.8);
181
+ border: 1px solid #3b82f6;
182
+ color: white;
183
+ padding: 8px 16px;
184
+ border-radius: 8px;
185
+ cursor: pointer;
186
+ transition: all 0.3s ease;
187
+ }
188
+
189
+ .upload-btn:hover {
190
+ background: rgba(59, 130, 246, 0.8);
191
+ }
192
+
193
+ #file-input {
194
+ display: none;
195
+ }
196
+
197
+ .upload-icon {
198
+ margin-right: 8px;
199
+ }
200
+
201
+ .avatar-placeholder-text {
202
+ color: rgba(255, 255, 255, 0.5);
203
+ font-size: 1.2rem;
204
+ text-align: center;
205
+ padding: 20px;
206
+ }
207
+
208
+ /* Floating action button styles */
209
+ .fab-container {
210
+ position: fixed;
211
+ bottom: 30px;
212
+ right: 30px;
213
+ z-index: 100;
214
+ display: flex;
215
+ flex-direction: column;
216
+ align-items: flex-end;
217
+ }
218
+
219
+ .fab-main {
220
+ width: 60px;
221
+ height: 60px;
222
+ border-radius: 50%;
223
+ background: linear-gradient(135deg, #3b82f6, #2563eb);
224
+ color: white;
225
+ display: flex;
226
+ align-items: center;
227
+ justify-content: center;
228
+ font-size: 24px;
229
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
230
+ cursor: pointer;
231
+ transition: all 0.3s ease;
232
+ z-index: 101;
233
+ }
234
+
235
+ .fab-main:hover {
236
+ transform: scale(1.1);
237
+ box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
238
+ }
239
+
240
+ .fab-menu {
241
+ position: absolute;
242
+ bottom: 70px;
243
+ right: 0;
244
+ width: 300px;
245
+ background: rgba(30, 41, 59, 0.95);
246
+ border-radius: 16px;
247
+ padding: 20px;
248
+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
249
+ transform: translateY(20px);
250
+ opacity: 0;
251
+ pointer-events: none;
252
+ transition: all 0.3s ease;
253
+ backdrop-filter: blur(10px);
254
+ }
255
+
256
+ .fab-menu.active {
257
+ transform: translateY(0);
258
+ opacity: 1;
259
+ pointer-events: all;
260
+ }
261
+
262
+ .fab-menu-header {
263
+ display: flex;
264
+ justify-content: space-between;
265
+ align-items: center;
266
+ margin-bottom: 15px;
267
+ }
268
+
269
+ .fab-menu-title {
270
+ font-weight: 600;
271
+ color: #3b82f6;
272
+ }
273
+
274
+ .fab-close-btn {
275
+ background: none;
276
+ border: none;
277
+ color: rgba(255, 255, 255, 0.5);
278
+ font-size: 20px;
279
+ cursor: pointer;
280
+ transition: all 0.2s ease;
281
+ }
282
+
283
+ .fab-close-btn:hover {
284
+ color: white;
285
+ }
286
+
287
+ .fab-menu-content {
288
+ max-height: 400px;
289
+ overflow-y: auto;
290
+ }
291
+
292
+ .fab-menu-tabs {
293
+ display: flex;
294
+ margin-bottom: 15px;
295
+ border-bottom: 1px solid rgba(255, 255, 255, 0.1);
296
+ }
297
+
298
+ .fab-tab {
299
+ padding: 8px 16px;
300
+ cursor: pointer;
301
+ color: rgba(255, 255, 255, 0.6);
302
+ font-size: 14px;
303
+ transition: all 0.2s ease;
304
+ border-bottom: 2px solid transparent;
305
+ }
306
+
307
+ .fab-tab.active {
308
+ color: white;
309
+ border-bottom: 2px solid #3b82f6;
310
+ }
311
+
312
+ .fab-tab:hover {
313
+ color: white;
314
+ }
315
+
316
+ .fab-tab-content {
317
+ display: none;
318
+ }
319
+
320
+ .fab-tab-content.active {
321
+ display: block;
322
+ }
323
+
324
+ .fab-chat-input {
325
+ display: flex;
326
+ gap: 10px;
327
+ margin-top: 15px;
328
+ }
329
+
330
+ .fab-chat-input input {
331
+ flex: 1;
332
+ background: rgba(15, 23, 42, 0.7);
333
+ border: 1px solid rgba(255, 255, 255, 0.1);
334
+ border-radius: 8px;
335
+ padding: 10px 15px;
336
+ color: white;
337
+ outline: none;
338
+ }
339
+
340
+ .fab-chat-input button {
341
+ background: #3b82f6;
342
+ color: white;
343
+ border: none;
344
+ border-radius: 8px;
345
+ padding: 0 15px;
346
+ cursor: pointer;
347
+ transition: all 0.2s ease;
348
+ }
349
+
350
+ .fab-chat-input button:hover {
351
+ background: #2563eb;
352
+ }
353
+
354
+ /* Scrollbar styling */
355
+ ::-webkit-scrollbar {
356
+ width: 6px;
357
+ }
358
+
359
+ ::-webkit-scrollbar-track {
360
+ background: rgba(255, 255, 255, 0.05);
361
+ border-radius: 3px;
362
+ }
363
+
364
+ ::-webkit-scrollbar-thumb {
365
+ background: rgba(255, 255, 255, 0.2);
366
+ border-radius: 3px;
367
+ }
368
+
369
+ ::-webkit-scrollbar-thumb:hover {
370
+ background: rgba(255, 255, 255, 0.3);
371
+ }
372
+ </style>
373
+ </head>
374
+ <body>
375
+ <!-- Video Avatar Container -->
376
+ <div class="video-container">
377
+ <div class="video-placeholder" id="video-placeholder">
378
+ <div class="avatar-placeholder-text">
379
+ <i class="fas fa-user-circle text-6xl mb-4"></i>
380
+ <p>Upload an image to create your AI video avatar</p>
381
+ </div>
382
+ </div>
383
+ <div class="video-overlay"></div>
384
+ </div>
385
+
386
+ <!-- Upload Button -->
387
+ <button class="upload-btn" onclick="document.getElementById('file-input').click()">
388
+ <i class="fas fa-upload upload-icon"></i>
389
+ Upload Avatar Image
390
+ </button>
391
+ <input type="file" id="file-input" accept="image/*">
392
+
393
+ <!-- Content Container -->
394
+ <div class="content-container">
395
+ <!-- Speech Bubble -->
396
+ <div class="speech-bubble p-6 mb-6 mx-4 relative">
397
+ <div id="avatar-message" class="text-lg">
398
+ Hello there! I'm your AI guide. Upload an image to create your personalized video avatar.
399
+ </div>
400
+ <div id="typing-indicator" class="typing-indicator hidden mt-2">
401
+ <span></span>
402
+ <span></span>
403
+ <span></span>
404
+ </div>
405
+ </div>
406
+
407
+ <!-- Social Media & Controls -->
408
+ <div class="flex justify-center gap-6 mt-8">
409
+ <button onclick="shareOnSocial('twitter')" class="social-icon text-blue-400 hover:text-blue-300 text-2xl">
410
+ <i class="fab fa-twitter"></i>
411
+ </button>
412
+ <button onclick="shareOnSocial('facebook')" class="social-icon text-blue-500 hover:text-blue-400 text-2xl">
413
+ <i class="fab fa-facebook"></i>
414
+ </button>
415
+ <button onclick="shareOnSocial('linkedin')" class="social-icon text-blue-600 hover:text-blue-500 text-2xl">
416
+ <i class="fab fa-linkedin"></i>
417
+ </button>
418
+ <button onclick="toggleFullscreen()" class="social-icon text-white hover:text-gray-300 text-2xl ml-4">
419
+ <i class="fas fa-expand"></i>
420
+ </button>
421
+ <button onclick="toggleMute()" class="social-icon text-white hover:text-gray-300 text-2xl">
422
+ <i id="mute-icon" class="fas fa-volume-up"></i>
423
+ </button>
424
+ </div>
425
+ </div>
426
+
427
+ <!-- Floating Action Button -->
428
+ <div class="fab-container">
429
+ <div class="fab-menu" id="fab-menu">
430
+ <div class="fab-menu-header">
431
+ <div class="fab-menu-title">AI Assistant</div>
432
+ <button class="fab-close-btn" onclick="toggleFabMenu()">
433
+ <i class="fas fa-times"></i>
434
+ </button>
435
+ </div>
436
+
437
+ <div class="fab-menu-tabs">
438
+ <div class="fab-tab active" onclick="switchTab('topics')">Topics</div>
439
+ <div class="fab-tab" onclick="switchTab('chat')">Chat</div>
440
+ </div>
441
+
442
+ <div class="fab-menu-content">
443
+ <div class="fab-tab-content active" id="topics-tab">
444
+ <div class="grid grid-cols-1 gap-3">
445
+ <div class="news-card p-4 rounded-xl cursor-pointer" onclick="selectTopic('technology')">
446
+ <h3 class="font-bold text-blue-300">Tech Updates</h3>
447
+ <p class="text-sm">Latest in AI and gadgets</p>
448
+ </div>
449
+ <div class="news-card p-4 rounded-xl cursor-pointer" onclick="selectTopic('entertainment')">
450
+ <h3 class="font-bold text-pink-300">Entertainment</h3>
451
+ <p class="text-sm">Movies, music and celebrity news</p>
452
+ </div>
453
+ </div>
454
+ </div>
455
+
456
+ <div class="fab-tab-content" id="chat-tab">
457
+ <div class="text-center text-gray-400 py-4">
458
+ Ask me anything about technology, entertainment, or current events
459
+ </div>
460
+ <div class="fab-chat-input">
461
+ <input type="text" id="fab-user-input" placeholder="Type your message...">
462
+ <button onclick="sendMessageFromFab()">
463
+ <i class="fas fa-paper-plane"></i>
464
+ </button>
465
+ </div>
466
+ </div>
467
+ </div>
468
+ </div>
469
+
470
+ <div class="fab-main" onclick="toggleFabMenu()">
471
+ <i class="fas fa-comment-dots"></i>
472
+ </div>
473
+ </div>
474
+
475
+ <script>
476
+ // Speech Synthesis
477
+ const synth = window.speechSynthesis;
478
+ let isSpeaking = false;
479
+ let isMuted = false;
480
+
481
+ // Sample knowledge base
482
+ const knowledgeBase = {
483
+ technology: [
484
+ "The latest AI models can now generate realistic video from text prompts. This could revolutionize content creation.",
485
+ "Quantum computing is making progress with several companies announcing breakthroughs in qubit stability.",
486
+ "The metaverse continues to evolve with new VR headsets offering higher resolution and better motion tracking."
487
+ ],
488
+ entertainment: [
489
+ "The summer blockbuster season is heating up with several highly anticipated movies releasing this month.",
490
+ "Streaming platforms are investing heavily in original content, with over 500 new shows announced this year.",
491
+ "Music festivals are returning in full force after the pandemic, with record ticket sales reported."
492
+ ],
493
+ default: [
494
+ "I'm here to help you stay informed about the latest trends and news.",
495
+ "Did you know I can summarize complex topics into easy-to-understand explanations?",
496
+ "Feel free to ask me about technology, entertainment, or current events."
497
+ ]
498
+ };
499
+
500
+ // Initialize
501
+ document.addEventListener('DOMContentLoaded', () => {
502
+ // Start with a greeting
503
+ setTimeout(() => {
504
+ speak("Hello there! I'm your AI guide. Upload an image to create your personalized video avatar.");
505
+ }, 1000);
506
+
507
+ // Set up image upload
508
+ document.getElementById('file-input').addEventListener('change', handleImageUpload);
509
+
510
+ // Set up keyboard events for fab input
511
+ document.getElementById('fab-user-input').addEventListener('keypress', (e) => {
512
+ if (e.key === 'Enter') {
513
+ sendMessageFromFab();
514
+ }
515
+ });
516
+ });
517
+
518
+ // Handle image upload
519
+ function handleImageUpload(event) {
520
+ const file = event.target.files[0];
521
+ if (!file) return;
522
+
523
+ const reader = new FileReader();
524
+ reader.onload = function(e) {
525
+ const placeholder = document.getElementById('video-placeholder');
526
+ placeholder.innerHTML = '';
527
+
528
+ const img = document.createElement('img');
529
+ img.src = e.target.result;
530
+ img.alt = 'AI Avatar';
531
+ placeholder.appendChild(img);
532
+
533
+ // Simulate video processing
534
+ setTimeout(() => {
535
+ speak("Thank you! Your AI video avatar is being processed. In a real implementation, this would generate a lifelike talking avatar from your image.");
536
+ }, 1000);
537
+ };
538
+ reader.readAsDataURL(file);
539
+ }
540
+
541
+ // Speech function
542
+ function speak(text) {
543
+ if (isMuted) return;
544
+
545
+ const utterance = new SpeechSynthesisUtterance(text);
546
+ utterance.voice = synth.getVoices().find(voice => voice.name.includes('English'));
547
+ utterance.pitch = 1;
548
+ utterance.rate = 1;
549
+ utterance.volume = 1;
550
+
551
+ isSpeaking = true;
552
+ synth.speak(utterance);
553
+
554
+ utterance.onend = () => {
555
+ isSpeaking = false;
556
+ };
557
+
558
+ // Display message
559
+ document.getElementById('avatar-message').textContent = text;
560
+ }
561
+
562
+ // Process user input
563
+ function sendMessage() {
564
+ const input = document.getElementById('user-input');
565
+ const message = input.value.trim();
566
+
567
+ if (message) {
568
+ // Show user message temporarily
569
+ document.getElementById('avatar-message').textContent = `You: ${message}`;
570
+ input.value = '';
571
+
572
+ // Show typing indicator
573
+ document.getElementById('typing-indicator').classList.remove('hidden');
574
+
575
+ // Process after delay
576
+ setTimeout(() => {
577
+ document.getElementById('typing-indicator').classList.add('hidden');
578
+ respondToMessage(message);
579
+ }, 1500);
580
+ }
581
+ }
582
+
583
+ // Process user input from FAB
584
+ function sendMessageFromFab() {
585
+ const input = document.getElementById('fab-user-input');
586
+ const message = input.value.trim();
587
+
588
+ if (message) {
589
+ // Show user message temporarily
590
+ document.getElementById('avatar-message').textContent = `You: ${message}`;
591
+ input.value = '';
592
+
593
+ // Show typing indicator
594
+ document.getElementById('typing-indicator').classList.remove('hidden');
595
+
596
+ // Process after delay
597
+ setTimeout(() => {
598
+ document.getElementById('typing-indicator').classList.add('hidden');
599
+ respondToMessage(message);
600
+ }, 1500);
601
+ }
602
+ }
603
+
604
+ // AI response logic
605
+ function respondToMessage(message) {
606
+ let response = "";
607
+ const lowerMsg = message.toLowerCase();
608
+
609
+ if (lowerMsg.includes('tech') || lowerMsg.includes('technology')) {
610
+ const techResponses = knowledgeBase.technology;
611
+ response = techResponses[Math.floor(Math.random() * techResponses.length)];
612
+ }
613
+ else if (lowerMsg.includes('movie') || lowerMsg.includes('music') || lowerMsg.includes('entertainment')) {
614
+ const entResponses = knowledgeBase.entertainment;
615
+ response = entResponses[Math.floor(Math.random() * entResponses.length)];
616
+ }
617
+ else if (lowerMsg.includes('hello') || lowerMsg.includes('hi')) {
618
+ response = "Hello! It's great to connect with you. How can I assist you today?";
619
+ }
620
+ else if (lowerMsg.includes('how are you')) {
621
+ response = "I'm an AI, so I don't have feelings, but I'm functioning optimally and ready to help you!";
622
+ }
623
+ else {
624
+ const defaultResponses = knowledgeBase.default;
625
+ response = defaultResponses[Math.floor(Math.random() * defaultResponses.length)];
626
+ }
627
+
628
+ speak(response);
629
+ }
630
+
631
+ // Topic selection
632
+ function selectTopic(topic) {
633
+ const message = `Tell me about ${topic}`;
634
+ document.getElementById('avatar-message').textContent = `You: ${message}`;
635
+
636
+ // Show typing indicator
637
+ document.getElementById('typing-indicator').classList.remove('hidden');
638
+
639
+ // Process after delay
640
+ setTimeout(() => {
641
+ document.getElementById('typing-indicator').classList.add('hidden');
642
+ respondToMessage(message);
643
+ }, 1500);
644
+
645
+ // Close the menu
646
+ toggleFabMenu();
647
+ }
648
+
649
+ // Social sharing
650
+ function shareOnSocial(platform) {
651
+ const text = encodeURIComponent("Check out this amazing AI video avatar I'm interacting with!");
652
+ const url = encodeURIComponent(window.location.href);
653
+
654
+ let shareUrl = "";
655
+ switch(platform) {
656
+ case 'twitter':
657
+ shareUrl = `https://twitter.com/intent/tweet?text=${text}&url=${url}`;
658
+ break;
659
+ case 'facebook':
660
+ shareUrl = `https://www.facebook.com/sharer/sharer.php?u=${url}`;
661
+ break;
662
+ case 'linkedin':
663
+ shareUrl = `https://www.linkedin.com/shareArticle?mini=true&url=${url}&title=${text}`;
664
+ break;
665
+ }
666
+
667
+ window.open(shareUrl, '_blank', 'width=600,height=400');
668
+ }
669
+
670
+ // Fullscreen toggle
671
+ function toggleFullscreen() {
672
+ if (!document.fullscreenElement) {
673
+ document.documentElement.requestFullscreen();
674
+ } else {
675
+ if (document.exitFullscreen) {
676
+ document.exitFullscreen();
677
+ }
678
+ }
679
+ }
680
+
681
+ // Mute toggle
682
+ function toggleMute() {
683
+ isMuted = !isMuted;
684
+ const icon = document.getElementById('mute-icon');
685
+
686
+ if (isMuted) {
687
+ icon.classList.remove('fa-volume-up');
688
+ icon.classList.add('fa-volume-mute');
689
+ synth.cancel();
690
+ } else {
691
+ icon.classList.remove('fa-volume-mute');
692
+ icon.classList.add('fa-volume-up');
693
+ }
694
+ }
695
+
696
+ // Toggle FAB menu
697
+ function toggleFabMenu() {
698
+ const menu = document.getElementById('fab-menu');
699
+ menu.classList.toggle('active');
700
+ }
701
+
702
+ // Switch between tabs in FAB menu
703
+ function switchTab(tabName) {
704
+ // Update active tab
705
+ document.querySelectorAll('.fab-tab').forEach(tab => {
706
+ tab.classList.remove('active');
707
+ });
708
+ event.target.classList.add('active');
709
+
710
+ // Update active content
711
+ document.querySelectorAll('.fab-tab-content').forEach(content => {
712
+ content.classList.remove('active');
713
+ });
714
+ document.getElementById(`${tabName}-tab`).classList.add('active');
715
+ }
716
+
717
+ // Keyboard support
718
+ document.getElementById('user-input').addEventListener('keypress', (e) => {
719
+ if (e.key === 'Enter') {
720
+ sendMessage();
721
+ }
722
+ });
723
+ </script>
724
+ <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/ai-avatar-agent-v1-0" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
725
+ </html>