File size: 22,945 Bytes
d7466ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Adiba's AI Assistant</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>
        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.5; }
        }
        .typing-indicator::after {
            content: '...';
            animation: typing 1.5s infinite;
        }
        @keyframes typing {
            0% { content: '.'; }
            33% { content: '..'; }
            66% { content: '...'; }
        }
        .message-animation {
            animation: fadeIn 0.3s ease-out;
        }
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .gradient-bg {
            background: linear-gradient(135deg, #6e8efb, #a777e3);
        }
        .language-selector {
            position: relative;
            display: inline-block;
        }
        .language-dropdown {
            display: none;
            position: absolute;
            right: 0;
            background-color: white;
            min-width: 120px;
            box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
            z-index: 1;
            border-radius: 8px;
            overflow: hidden;
        }
        .language-selector:hover .language-dropdown {
            display: block;
        }
        .language-option {
            padding: 8px 16px;
            display: flex;
            align-items: center;
            cursor: pointer;
        }
        .language-option:hover {
            background-color: #f1f1f1;
        }
        .language-flag {
            width: 20px;
            margin-right: 8px;
        }
    </style>
</head>
<body class="bg-gray-100 font-sans">
    <div class="flex flex-col h-screen max-w-4xl mx-auto">
        <!-- Header -->
        <header class="gradient-bg text-white p-4 shadow-md">
            <div class="flex items-center justify-between">
                <div class="flex items-center space-x-3">
                    <div class="w-10 h-10 rounded-full bg-white flex items-center justify-center">
                        <i class="fas fa-robot text-purple-600 text-xl"></i>
                    </div>
                    <div>
                        <h1 class="font-bold text-lg">Adiba's AI Assistant</h1>
                        <p class="text-xs opacity-80" id="subtitle">Always here to help</p>
                    </div>
                </div>
                <div class="flex space-x-2 items-center">
                    <div class="language-selector">
                        <button class="p-2 rounded-full hover:bg-white/10 transition flex items-center">
                            <img src="https://flagcdn.com/w20/gb.png" class="language-flag" id="current-flag">
                            <span id="current-language">English</span>
                        </button>
                        <div class="language-dropdown">
                            <div class="language-option" data-lang="en">
                                <img src="https://flagcdn.com/w20/gb.png" class="language-flag">
                                <span>English</span>
                            </div>
                            <div class="language-option" data-lang="de">
                                <img src="https://flagcdn.com/w20/de.png" class="language-flag">
                                <span>Deutsch</span>
                            </div>
                            <div class="language-option" data-lang="uz">
                                <img src="https://flagcdn.com/w20/uz.png" class="language-flag">
                                <span>O'zbekcha</span>
                            </div>
                        </div>
                    </div>
                    <button class="p-2 rounded-full hover:bg-white/10 transition">
                        <i class="fas fa-cog"></i>
                    </button>
                </div>
            </div>
        </header>

        <!-- Chat Container -->
        <div class="flex-1 overflow-y-auto p-4 space-y-4" id="chat-container">
            <!-- AI Welcome Message -->
            <div class="message-animation flex space-x-3">
                <div class="flex-shrink-0">
                    <div class="w-8 h-8 rounded-full bg-purple-500 flex items-center justify-center">
                        <i class="fas fa-robot text-white text-sm"></i>
                    </div>
                </div>
                <div class="bg-white p-3 rounded-lg shadow-sm max-w-[85%]">
                    <p class="text-gray-800" id="welcome-message">Hello Adiba! 👋 I'm your personal AI assistant. I can help with coding, design, research, and much more. What would you like to explore today?</p>
                    <div class="mt-2 flex flex-wrap gap-2">
                        <button class="suggestion-btn px-3 py-1 bg-gray-100 hover:bg-gray-200 rounded-full text-sm transition" data-key="design">Website design tips</button>
                        <button class="suggestion-btn px-3 py-1 bg-gray-100 hover:bg-gray-200 rounded-full text-sm transition" data-key="code">JavaScript help</button>
                        <button class="suggestion-btn px-3 py-1 bg-gray-100 hover:bg-gray-200 rounded-full text-sm transition" data-key="ideas">Creative ideas</button>
                    </div>
                    <p class="text-xs text-gray-500 mt-2" id="prompt-text">Just type your question below ↓</p>
                </div>
            </div>
        </div>

        <!-- Input Area -->
        <div class="border-t p-4 bg-white">
            <form id="message-form" class="flex space-x-2">
                <div class="flex-1 relative">
                    <input 
                        type="text" 
                        id="message-input" 
                        placeholder="Message Adiba's AI..." 
                        class="w-full p-3 pr-10 border rounded-full focus:outline-none focus:ring-2 focus:ring-purple-300"
                        autocomplete="off"
                    >
                    <button type="button" class="absolute right-3 top-3 text-gray-400 hover:text-purple-600">
                        <i class="fas fa-microphone"></i>
                    </button>
                </div>
                <button 
                    type="submit" 
                    class="w-12 h-12 rounded-full gradient-bg text-white flex items-center justify-center hover:opacity-90 transition"
                >
                    <i class="fas fa-paper-plane"></i>
                </button>
            </form>
            <p class="text-xs text-gray-500 mt-2 text-center" id="disclaimer">AI may produce inaccurate information. Free Research Preview.</p>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const form = document.getElementById('message-form');
            const input = document.getElementById('message-input');
            const chatContainer = document.getElementById('chat-container');
            const currentLanguage = document.getElementById('current-language');
            const currentFlag = document.getElementById('current-flag');
            const welcomeMessage = document.getElementById('welcome-message');
            const promptText = document.getElementById('prompt-text');
            const subtitle = document.getElementById('subtitle');
            const disclaimer = document.getElementById('disclaimer');
            
            // Language data
            const languages = {
                en: {
                    name: "English",
                    flag: "https://flagcdn.com/w20/gb.png",
                    translations: {
                        welcome: "Hello Adiba! 👋 I'm your personal AI assistant. I can help with coding, design, research, and much more. What would you like to explore today?",
                        design: "Website design tips",
                        code: "JavaScript help",
                        ideas: "Creative ideas",
                        prompt: "Just type your question below ↓",
                        subtitle: "Always here to help",
                        disclaimer: "AI may produce inaccurate information. Free Research Preview.",
                        responses: {
                            "hello": "Hi Adiba! 😊 How can I assist you today?",
                            "website design tips": "For beautiful website design, consider:<br>1. Consistent color palette<br>2. Proper spacing and alignment<br>3. Readable typography<br>4. Mobile responsiveness<br>5. Intuitive navigation<br><br>Would you like me to generate some design mockups for you?",
                            "javascript help": "Of course! Here's a quick JavaScript example:<br><br><code class='bg-gray-100 p-2 rounded block'>// Simple array manipulation<br>const numbers = [1, 2, 3, 4];<br>const doubled = numbers.map(num => num * 2);<br>console.log(doubled); // [2, 4, 6, 8]</code><br><br>What specific JavaScript concept do you need help with?",
                            "creative ideas": "Here are 3 creative project ideas:<br>1. Interactive portfolio with 3D elements<br>2. AI-generated poetry generator<br>3. Personal dashboard that visualizes your daily habits<br><br>Want me to elaborate on any of these?",
                            "default": "I'm an AI assistant here to help with coding, design, research, and creative projects. I can generate code snippets, design mockups, explain concepts, and brainstorm ideas. What specifically would you like me to help with?"
                        }
                    }
                },
                de: {
                    name: "Deutsch",
                    flag: "https://flagcdn.com/w20/de.png",
                    translations: {
                        welcome: "Hallo Adiba! 👋 Ich bin dein persönlicher KI-Assistent. Ich kann dir bei Codierung, Design, Recherche und vielem mehr helfen. Wonach möchtest du heute suchen?",
                        design: "Website-Design-Tipps",
                        code: "JavaScript-Hilfe",
                        ideas: "Kreative Ideen",
                        prompt: "Tippe einfach deine Frage unten ein ↓",
                        subtitle: "Immer hier, um zu helfen",
                        disclaimer: "KI kann ungenaue Informationen liefern. Kostenlose Forschungsvorschau.",
                        responses: {
                            "hallo": "Hallo Adiba! 😊 Wie kann ich dir heute helfen?",
                            "website design tipps": "Für ein schönes Webdesign sollten Sie Folgendes beachten:<br>1. Konsistente Farbpalette<br>2. Richtiger Abstand und Ausrichtung<br>3. Lesbare Typografie<br>4. Mobile Reaktionsfähigkeit<br>5. Intuitive Navigation<br><br>Möchten Sie, dass ich einige Design-Mockups für Sie erstelle?",
                            "javascript hilfe": "Natürlich! Hier ist ein kurzes JavaScript-Beispiel:<br><br><code class='bg-gray-100 p-2 rounded block'>// Einfache Array-Manipulation<br>const zahlen = [1, 2, 3, 4];<br>const verdoppelt = zahlen.map(num => num * 2);<br>console.log(verdoppelt); // [2, 4, 6, 8]</code><br><br>Mit welchem spezifischen JavaScript-Konzept brauchen Sie Hilfe?",
                            "kreative ideen": "Hier sind 3 kreative Projektideen:<br>1. Interaktives Portfolio mit 3D-Elementen<br>2. KI-generierter Poesie-Generator<br>3. Persönliches Dashboard, das Ihre täglichen Gewohnheiten visualisiert<br><br>Möchten Sie, dass ich eines davon näher erläutere?",
                            "default": "Ich bin ein KI-Assistent, der bei Codierung, Design, Recherche und kreativen Projekten hilft. Ich kann Code-Snippets generieren, Design-Mockups erstellen, Konzepte erklären und Ideen entwickeln. Wobei genau kann ich Ihnen helfen?"
                        }
                    }
                },
                uz: {
                    name: "O'zbekcha",
                    flag: "https://flagcdn.com/w20/uz.png",
                    translations: {
                        welcome: "Salom Adiba! 👋 Men sizning shaxsiy AI yordamchingizman. Kod yozish, dizayn, tadqiqot va boshqa ko'p narsalarda yordam bera olaman. Bugun nima bilan shug'ullanishni xohlaysiz?",
                        design: "Vebsayt dizayn maslahatlari",
                        code: "JavaScript yordami",
                        ideas: "Ijodiy g'oyalar",
                        prompt: "Savolingizni quyida yozing ↓",
                        subtitle: "Doimo yordamga tayyor",
                        disclaimer: "AI noto'g'ri ma'lumotlar berishi mumkin. Bepul tadqiqot ko'rib chiqish.",
                        responses: {
                            "salom": "Salom Adiba! 😊 Bugun sizga qanday yordam bera olaman?",
                            "vebsayt dizayn maslahatlari": "Chiroyli vebsayt dizayni uchun quyidagilarni hisobga oling:<br>1. Izchil rang palitrasi<br>2. To'g'ri joylashuv va tekislash<br>3. O'qish uchun qulay shrift<br>4> Mobil moslashuvchanlik<br>5. Intuitiv navigatsiya<br><br>Siz uchun ba'zi dizayn maketlarini yaratishimni xohlaysizmi?",
                            "javascript yordami": "Albatta! Mana JavaScriptda oddiy misol:<br><br><code class='bg-gray-100 p-2 rounded block'>// Oddiy massiv manipulyatsiyasi<br>const sonlar = [1, 2, 3, 4];<br>const ikkiBarobar = sonlar.map(son => son * 2);<br>console.log(ikkiBarobar); // [2, 4, 6, 8]</code><br><br>Qaysi JavaScript konsepsiyasi haqida yordam kerak?",
                            "ijodiy g'oyalar": "Mana 3 ta ijodiy loyiha g'oyasi:<br>1. 3D elementlar bilan interaktiv portfolio<br>2. AI tomonidan yaratilgan she'r generatori<br>3. Kunlik odatlaringizni vizualizatsiya qiluvchi shaxsiy boshqaruv paneli<br><br>Ulardan birini batafsil tushuntirishimni xohlaysizmi?",
                            "default": "Men kodlash, dizayn, tadqiqot va ijodiy loyihalarda yordam beradigan AI yordamchiman. Kod parchalarini yaratish, dizayn maketlarini ishlab chiqish, tushunchalarni tushuntirish va g'oyalar yaratishda yordam bera olaman. Aniq qanday yordam kerak?"
                        }
                    }
                }
            };

            let currentLang = 'en';

            // Set language
            function setLanguage(lang) {
                currentLang = lang;
                const langData = languages[lang];
                
                currentLanguage.textContent = langData.name;
                currentFlag.src = langData.flag;
                welcomeMessage.textContent = langData.translations.welcome;
                promptText.textContent = langData.translations.prompt;
                subtitle.textContent = langData.translations.subtitle;
                disclaimer.textContent = langData.translations.disclaimer;
                
                // Update suggestion buttons
                document.querySelectorAll('.suggestion-btn[data-key="design"]').forEach(btn => {
                    btn.textContent = langData.translations.design;
                });
                document.querySelectorAll('.suggestion-btn[data-key="code"]').forEach(btn => {
                    btn.textContent = langData.translations.code;
                });
                document.querySelectorAll('.suggestion-btn[data-key="ideas"]').forEach(btn => {
                    btn.textContent = langData.translations.ideas;
                });
                
                // Update input placeholder
                input.placeholder = lang === 'en' ? "Message Adiba's AI..." : 
                                  lang === 'de' ? "Nachricht an Adibas KI..." : 
                                  "Adiba AI-ga xabar...";
            }

            // Language selector
            document.querySelectorAll('.language-option').forEach(option => {
                option.addEventListener('click', function() {
                    const lang = this.getAttribute('data-lang');
                    setLanguage(lang);
                });
            });

            form.addEventListener('submit', function(e) {
                e.preventDefault();
                const message = input.value.trim();
                if (!message) return;

                // Add user message
                addMessage(message, 'user');
                input.value = '';

                // Show typing indicator
                const typingIndicator = document.createElement('div');
                typingIndicator.className = 'flex space-x-3';
                typingIndicator.innerHTML = `
                    <div class="flex-shrink-0">
                        <div class="w-8 h-8 rounded-full bg-purple-500 flex items-center justify-center">
                            <i class="fas fa-robot text-white text-sm"></i>
                        </div>
                    </div>
                    <div class="bg-white p-3 rounded-lg shadow-sm max-w-[85%]">
                        <div class="typing-indicator flex space-x-1">
                            <div class="w-2 h-2 rounded-full bg-gray-400 animate-pulse"></div>
                            <div class="w-2 h-2 rounded-full bg-gray-400 animate-pulse" style="animation-delay: 0.2s"></div>
                            <div class="w-2 h-2 rounded-full bg-gray-400 animate-pulse" style="animation-delay: 0.4s"></div>
                        </div>
                    </div>
                `;
                chatContainer.appendChild(typingIndicator);
                chatContainer.scrollTop = chatContainer.scrollHeight;

                // Simulate AI response after delay
                setTimeout(() => {
                    chatContainer.removeChild(typingIndicator);
                    
                    const langData = languages[currentLang].translations;
                    let response = langData.responses.default;
                    const lowerMessage = message.toLowerCase();
                    
                    // Check for greetings in all languages
                    if (lowerMessage.includes('hello') || lowerMessage.includes('hi') || 
                        lowerMessage.includes('hallo') || lowerMessage.includes('salom')) {
                        response = langData.responses.hello || langData.responses.default;
                    }
                    // Check for design queries
                    else if (lowerMessage.includes('design') || lowerMessage.includes('dizayn') || 
                             lowerMessage.includes('gestaltung') || lowerMessage.includes('dizayn maslahatlari')) {
                        response = langData.responses["website design tips"] || langData.responses.default;
                    }
                    // Check for code queries
                    else if (lowerMessage.includes('javascript') || lowerMessage.includes('code') || 
                             lowerMessage.includes('kod') || lowerMessage.includes('yordami')) {
                        response = langData.responses["javascript help"] || langData.responses.default;
                    }
                    // Check for idea queries
                    else if (lowerMessage.includes('idea') || lowerMessage.includes('creative') || 
                             lowerMessage.includes('idee') || lowerMessage.includes('g'idea')) {
                        response = langData.responses["creative ideas"] || langData.responses.default;
                    }
                    
                    addMessage(response, 'ai');
                }, 1500 + Math.random() * 2000);
            });

            // Add click handlers for suggestion buttons
            document.querySelectorAll('.suggestion-btn').forEach(button => {
                button.addEventListener('click', function() {
                    const key = this.getAttribute('data-key');
                    const langData = languages[currentLang].translations;
                    
                    if (key === 'design') {
                        input.value = langData.design;
                    } else if (key === 'code') {
                        input.value = langData.code;
                    } else if (key === 'ideas') {
                        input.value = langData.ideas;
                    }
                    
                    input.focus();
                });
            });

            function addMessage(content, sender) {
                const messageDiv = document.createElement('div');
                messageDiv.className = 'message-animation flex space-x-3';
                
                if (sender === 'user') {
                    messageDiv.innerHTML = `
                        <div class="flex-shrink-0 ml-auto">
                            <div class="w-8 h-8 rounded-full bg-gray-300 flex items-center justify-center">
                                <i class="fas fa-user text-gray-600 text-sm"></i>
                            </div>
                        </div>
                        <div class="bg-purple-100 p-3 rounded-lg shadow-sm max-w-[85%]">
                            <p class="text-gray-800">${content}</p>
                        </div>
                    `;
                } else {
                    messageDiv.innerHTML = `
                        <div class="flex-shrink-0">
                            <div class="w-8 h-8 rounded-full bg-purple-500 flex items-center justify-center">
                                <i class="fas fa-robot text-white text-sm"></i>
                            </div>
                        </div>
                        <div class="bg-white p-3 rounded-lg shadow-sm max-w-[85%]">
                            <p class="text-gray-800">${content}</p>
                        </div>
                    `;
                }
                
                chatContainer.appendChild(messageDiv);
                chatContainer.scrollTop = chatContainer.scrollHeight;
            }
        });
    </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=Meszod/web-chat" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>