|
<!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 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> |
|
|
|
|
|
<div class="flex-1 overflow-y-auto p-4 space-y-4" id="chat-container"> |
|
|
|
<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> |
|
|
|
|
|
<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> |