Download index.html from lllerl/eux: direct link, hf CLI and curl.
- Browser
- Download file 31.6 kB
-
https://huggingface.co/spaces/lllerl/eux/resolve/main/index.html
- Command line
-
hf download hf://spaces/lllerl/eux/index.html
-
curl -L -o index.html https://huggingface.co/spaces/lllerl/eux/resolve/main/index.html
31.6 kB
| <html lang="en" dir="ltr"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>AI Mentor Minds - Choose Your Mentor</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> | |
| @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap'); | |
| :root { | |
| --primary: #06b6d4; | |
| --dark: #1e293b; | |
| --light: #f8fafc; | |
| } | |
| body { | |
| font-family: 'Poppins', sans-serif; | |
| transition: background-color 0.3s ease; | |
| } | |
| .character-card { | |
| transition: all 0.3s ease; | |
| } | |
| .character-card:hover { | |
| transform: translateY(-5px); | |
| box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); | |
| } | |
| .chat-bubble { | |
| max-width: 80%; | |
| border-radius: 1.125rem; | |
| line-height: 1.25; | |
| position: relative; | |
| word-wrap: break-word; | |
| } | |
| .user-bubble { | |
| background-color: var(--primary); | |
| color: white; | |
| align-self: flex-end; | |
| } | |
| .character-bubble { | |
| background-color: white; | |
| color: var(--dark); | |
| align-self: flex-start; | |
| } | |
| .dark .character-bubble { | |
| background-color: #334155; | |
| color: var(--light); | |
| } | |
| .typing-indicator span { | |
| height: 8px; | |
| width: 8px; | |
| background-color: #9ca3af; | |
| border-radius: 50%; | |
| display: inline-block; | |
| margin: 0 2px; | |
| animation: bounce 1.5s infinite ease-in-out; | |
| } | |
| .typing-indicator span:nth-child(2) { | |
| animation-delay: 0.2s; | |
| } | |
| .typing-indicator span:nth-child(3) { | |
| animation-delay: 0.4s; | |
| } | |
| @keyframes bounce { | |
| 0%, 60%, 100% { transform: translateY(0); } | |
| 30% { transform: translateY(-5px); } | |
| } | |
| .language-toggle { | |
| position: relative; | |
| width: 80px; | |
| height: 36px; | |
| } | |
| .language-toggle input { | |
| opacity: 0; | |
| width: 0; | |
| height: 0; | |
| } | |
| .language-slider { | |
| position: absolute; | |
| cursor: pointer; | |
| top: 0; | |
| left: 0; | |
| right: 0; | |
| bottom: 0; | |
| background-color: #e2e8f0; | |
| transition: .4s; | |
| border-radius: 34px; | |
| display: flex; | |
| align-items: center; | |
| justify-content: space-between; | |
| padding: 0 10px; | |
| font-weight: bold; | |
| font-size: 12px; | |
| color: #64748b; | |
| } | |
| .language-slider:before { | |
| position: absolute; | |
| content: ""; | |
| height: 28px; | |
| width: 28px; | |
| left: 4px; | |
| bottom: 4px; | |
| background-color: white; | |
| transition: .4s; | |
| border-radius: 50%; | |
| box-shadow: 0 1px 3px rgba(0,0,0,0.1); | |
| } | |
| input:checked + .language-slider { | |
| background-color: var(--primary); | |
| } | |
| input:checked + .language-slider:before { | |
| transform: translateX(44px); | |
| } | |
| .page { | |
| display: none; | |
| } | |
| .page.active { | |
| display: block; | |
| } | |
| .character-icon { | |
| font-size: 2.5rem; | |
| margin-bottom: 0.5rem; | |
| } | |
| .back-btn { | |
| transition: transform 0.2s ease; | |
| } | |
| .back-btn:active { | |
| transform: scale(0.9); | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-50 dark:bg-gray-900 text-gray-900 dark:text-gray-100"> | |
| <div class="min-h-screen flex flex-col"> | |
| <!-- Home Screen --> | |
| <div id="homeScreen" class="page active flex flex-col flex-1 p-6"> | |
| <!-- Header --> | |
| <header class="flex justify-center items-center mb-8"> | |
| <div class="text-center"> | |
| <div class="flex justify-center mb-2"> | |
| <div class="bg-indigo-100 dark:bg-indigo-900 p-3 rounded-full"> | |
| <i class="fas fa-brain text-indigo-600 dark:text-indigo-300 text-3xl"></i> | |
| </div> | |
| </div> | |
| <h1 class="text-2xl font-bold" id="mainTitle">Choose Your Mentor</h1> | |
| </div> | |
| </header> | |
| <!-- Settings Button --> | |
| <button id="settingsBtn" class="absolute top-6 right-6 p-2 rounded-full bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300"> | |
| <i class="fas fa-cog"></i> | |
| </button> | |
| <!-- Character Grid --> | |
| <div class="grid grid-cols-2 gap-4 mb-8"> | |
| <!-- Cristiano Ronaldo --> | |
| <div class="character-card bg-white dark:bg-gray-800 rounded-xl p-6 flex flex-col items-center shadow-sm cursor-pointer" data-character="ronaldo"> | |
| <div class="character-icon bg-blue-100 dark:bg-blue-900 text-blue-600 dark:text-blue-300 p-3 rounded-full"> | |
| <i class="fas fa-futbol"></i> | |
| </div> | |
| <span class="font-medium">Cristiano</span> | |
| </div> | |
| <!-- Elon Musk --> | |
| <div class="character-card bg-white dark:bg-gray-800 rounded-xl p-6 flex flex-col items-center shadow-sm cursor-pointer" data-character="musk"> | |
| <div class="character-icon bg-purple-100 dark:bg-purple-900 text-purple-600 dark:text-purple-300 p-3 rounded-full"> | |
| <i class="fas fa-rocket"></i> | |
| </div> | |
| <span class="font-medium">Elon Musk</span> | |
| </div> | |
| <!-- Eren Yeager --> | |
| <div class="character-card bg-white dark:bg-gray-800 rounded-xl p-6 flex flex-col items-center shadow-sm cursor-pointer" data-character="eren"> | |
| <div class="character-icon bg-yellow-100 dark:bg-yellow-900 text-yellow-600 dark:text-yellow-300 p-3 rounded-full"> | |
| <i class="fas fa-bolt"></i> | |
| </div> | |
| <span class="font-medium">Eren</span> | |
| </div> | |
| <!-- Itachi Uchiha --> | |
| <div class="character-card bg-white dark:bg-gray-800 rounded-xl p-6 flex flex-col items-center shadow-sm cursor-pointer" data-character="itachi"> | |
| <div class="character-icon bg-red-100 dark:bg-red-900 text-red-600 dark:text-red-300 p-3 rounded-full"> | |
| <i class="fas fa-star"></i> | |
| </div> | |
| <span class="font-medium">Itachi</span> | |
| </div> | |
| </div> | |
| <!-- Language Toggle --> | |
| <div class="mt-auto flex justify-center"> | |
| <label class="language-toggle"> | |
| <input type="checkbox" id="languageToggle"> | |
| <span class="language-slider"> | |
| <span>AR</span> | |
| <span>EN</span> | |
| </span> | |
| </label> | |
| </div> | |
| </div> | |
| <!-- Chat Screen --> | |
| <div id="chatScreen" class="page flex flex-col flex-1"> | |
| <!-- Chat Header --> | |
| <header class="bg-white dark:bg-gray-800 p-4 shadow-sm flex items-center"> | |
| <button id="backBtn" class="back-btn p-2 mr-3 rounded-full bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300"> | |
| <i class="fas fa-arrow-left"></i> | |
| </button> | |
| <div id="characterDisplay" class="flex items-center"> | |
| <div id="currentCharacterIcon" class="w-10 h-10 rounded-full bg-blue-100 dark:bg-blue-900 flex items-center justify-center mr-3"> | |
| <i class="fas fa-futbol text-blue-600 dark:text-blue-300"></i> | |
| </div> | |
| <div> | |
| <h2 id="currentCharacterName" class="font-bold">Mentor</h2> | |
| </div> | |
| </div> | |
| </header> | |
| <!-- Chat Messages --> | |
| <div id="chatContainer" class="flex-1 p-4 overflow-y-auto space-y-4"> | |
| <div class="flex flex-col items-center justify-center h-full text-gray-500"> | |
| <i class="fas fa-comments text-4xl mb-2"></i> | |
| <p id="welcomeMessageText">Select a mentor to start your conversation</p> | |
| </div> | |
| </div> | |
| <!-- Message Input --> | |
| <div class="p-4 border-t border-gray-200 dark:border-gray-700"> | |
| <div class="flex items-center space-x-2"> | |
| <input id="messageInput" type="text" placeholder="Type your message..." class="flex-1 px-4 py-2 rounded-full border border-gray-300 dark:border-gray-600 dark:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-cyan-500"> | |
| <button id="sendMessageBtn" class="bg-cyan-500 hover:bg-cyan-600 text-white p-2 rounded-full w-10 h-10 flex items-center justify-center"> | |
| <i class="fas fa-paper-plane"></i> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Settings Screen --> | |
| <div id="settingsScreen" class="page flex flex-col flex-1 p-6"> | |
| <!-- Header --> | |
| <header class="flex items-center mb-8"> | |
| <button id="backSettingsBtn" class="back-btn p-2 mr-3 rounded-full bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300"> | |
| <i class="fas fa-arrow-left"></i> | |
| </button> | |
| <h1 class="text-xl font-bold" id="settingsTitle">Settings</h1> | |
| </header> | |
| <!-- Settings Content --> | |
| <div class="space-y-6"> | |
| <!-- Language Setting --> | |
| <div class="bg-white dark:bg-gray-800 rounded-xl p-4 shadow-sm"> | |
| <h2 class="font-medium mb-3 flex items-center"> | |
| <i class="fas fa-language mr-2"></i> | |
| <span id="languageSettingText">Language</span> | |
| </h2> | |
| <div class="flex justify-between items-center"> | |
| <span id="languageDescriptionText">App language</span> | |
| <label class="language-toggle"> | |
| <input type="checkbox" id="settingsLanguageToggle"> | |
| <span class="language-slider"> | |
| <span>AR</span> | |
| <span>EN</span> | |
| </span> | |
| </label> | |
| </div> | |
| </div> | |
| <!-- Reset Conversations --> | |
| <div class="bg-white dark:bg-gray-800 rounded-xl p-4 shadow-sm"> | |
| <h2 class="font-medium mb-3 flex items-center"> | |
| <i class="fas fa-eraser mr-2"></i> | |
| <span id="resetConversationsText">Reset Conversations</span> | |
| </h2> | |
| <p class="text-sm text-gray-500 dark:text-gray-400 mb-3" id="resetDescriptionText">Clear all saved chat history</p> | |
| <button id="resetBtn" class="w-full py-2 bg-red-100 dark:bg-red-900 text-red-600 dark:text-red-300 rounded-lg font-medium"> | |
| <i class="fas fa-trash-alt mr-2"></i> | |
| <span id="resetButtonText">Reset Now</span> | |
| </button> | |
| </div> | |
| <!-- About Characters --> | |
| <div class="bg-white dark:bg-gray-800 rounded-xl p-4 shadow-sm"> | |
| <h2 class="font-medium mb-3 flex items-center"> | |
| <i class="fas fa-info-circle mr-2"></i> | |
| <span id="aboutCharactersText">About Characters</span> | |
| </h2> | |
| <div class="space-y-4"> | |
| <!-- Cristiano --> | |
| <div class="flex items-start space-x-3"> | |
| <div class="bg-blue-100 dark:bg-blue-900 text-blue-600 dark:text-blue-300 p-2 rounded-full"> | |
| <i class="fas fa-futbol"></i> | |
| </div> | |
| <div> | |
| <h3 class="font-medium">Cristiano Ronaldo</h3> | |
| <p class="text-sm text-gray-500 dark:text-gray-400" id="cristianoBio">Football legend known for discipline, hard work, and relentless pursuit of excellence.</p> | |
| </div> | |
| </div> | |
| <!-- Elon Musk --> | |
| <div class="flex items-start space-x-3"> | |
| <div class="bg-purple-100 dark:bg-purple-900 text-purple-600 dark:text-purple-300 p-2 rounded-full"> | |
| <i class="fas fa-rocket"></i> | |
| </div> | |
| <div> | |
| <h3 class="font-medium">Elon Musk</h3> | |
| <p class="text-sm text-gray-500 dark:text-gray-400" id="elonBio">Visionary entrepreneur focused on innovation, risk-taking, and pushing boundaries.</p> | |
| </div> | |
| </div> | |
| <!-- Eren Yeager --> | |
| <div class="flex items-start space-x-3"> | |
| <div class="bg-yellow-100 dark:bg-yellow-900 text-yellow-600 dark:text-yellow-300 p-2 rounded-full"> | |
| <i class="fas fa-bolt"></i> | |
| </div> | |
| <div> | |
| <h3 class="font-medium">Eren Yeager</h3> | |
| <p class="text-sm text-gray-500 dark:text-gray-400" id="erenBio">Driven by intense emotions and unwavering determination to achieve freedom.</p> | |
| </div> | |
| </div> | |
| <!-- Itachi Uchiha --> | |
| <div class="flex items-start space-x-3"> | |
| <div class="bg-red-100 dark:bg-red-900 text-red-600 dark:text-red-300 p-2 rounded-full"> | |
| <i class="fas fa-star"></i> | |
| </div> | |
| <div> | |
| <h3 class="font-medium">Itachi Uchiha</h3> | |
| <p class="text-sm text-gray-500 dark:text-gray-400" id="itachiBio">Philosophical ninja who values sacrifice, wisdom, and seeing the bigger picture.</p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| // DOM Elements | |
| const homeScreen = document.getElementById('homeScreen'); | |
| const chatScreen = document.getElementById('chatScreen'); | |
| const settingsScreen = document.getElementById('settingsScreen'); | |
| const settingsBtn = document.getElementById('settingsBtn'); | |
| const backBtn = document.getElementById('backBtn'); | |
| const backSettingsBtn = document.getElementById('backSettingsBtn'); | |
| const languageToggle = document.getElementById('languageToggle'); | |
| const settingsLanguageToggle = document.getElementById('settingsLanguageToggle'); | |
| const resetBtn = document.getElementById('resetBtn'); | |
| const characterCards = document.querySelectorAll('.character-card'); | |
| const currentCharacterName = document.getElementById('currentCharacterName'); | |
| const currentCharacterIcon = document.getElementById('currentCharacterIcon'); | |
| const chatContainer = document.getElementById('chatContainer'); | |
| const messageInput = document.getElementById('messageInput'); | |
| const sendMessageBtn = document.getElementById('sendMessageBtn'); | |
| // Text Elements for translation | |
| const textElements = { | |
| mainTitle: document.getElementById('mainTitle'), | |
| welcomeMessageText: document.getElementById('welcomeMessageText'), | |
| settingsTitle: document.getElementById('settingsTitle'), | |
| languageSettingText: document.getElementById('languageSettingText'), | |
| languageDescriptionText: document.getElementById('languageDescriptionText'), | |
| resetConversationsText: document.getElementById('resetConversationsText'), | |
| resetDescriptionText: document.getElementById('resetDescriptionText'), | |
| resetButtonText: document.getElementById('resetButtonText'), | |
| aboutCharactersText: document.getElementById('aboutCharactersText'), | |
| cristianoBio: document.getElementById('cristianoBio'), | |
| elonBio: document.getElementById('elonBio'), | |
| erenBio: document.getElementById('erenBio'), | |
| itachiBio: document.getElementById('itachiBio') | |
| }; | |
| // App State | |
| let currentLanguage = 'en'; | |
| let currentCharacter = null; | |
| let messages = []; | |
| // Character Data | |
| const characters = { | |
| ronaldo: { | |
| name: 'Cristiano Ronaldo', | |
| icon: 'fas fa-futbol', | |
| iconColor: 'bg-blue-100 dark:bg-blue-900 text-blue-600 dark:text-blue-300', | |
| responses: [ | |
| "Hard work beats talent when talent fails to work hard. I didn't get to the top by dreaming, I got there by working hard every single day.", | |
| "Your love makes me strong, your hate makes me unstoppable. Use criticism as fuel to push yourself further.", | |
| "I'm not a perfectionist, but I like to feel that things are done well. More important than that, I feel an endless need to learn, to improve, to evolve." | |
| ] | |
| }, | |
| musk: { | |
| name: 'Elon Musk', | |
| icon: 'fas fa-rocket', | |
| iconColor: 'bg-purple-100 dark:bg-purple-900 text-purple-600 dark:text-purple-300', | |
| responses: [ | |
| "When something is important enough, you do it even if the odds are not in your favor. That's how great things are achieved.", | |
| "Persistence is very important. You should not give up unless you are forced to give up.", | |
| "If you're trying to create a company, it's like baking a cake. You have to have all the ingredients in the right proportion." | |
| ] | |
| }, | |
| eren: { | |
| name: 'Eren Yeager', | |
| icon: 'fas fa-bolt', | |
| iconColor: 'bg-yellow-100 dark:bg-yellow-900 text-yellow-600 dark:text-yellow-300', | |
| responses: [ | |
| "If you don't fight, you can't win! The world is cruel, but it's also very beautiful. Fight for what you believe in!", | |
| "I was born into this world. That alone gives me the right to pursue my freedom with everything I have!", | |
| "I keep moving forward... until I destroy my enemies. Never stop, never give up, no matter what stands in your way." | |
| ] | |
| }, | |
| itachi: { | |
| name: 'Itachi Uchiha', | |
| icon: 'fas fa-star', | |
| iconColor: 'bg-red-100 dark:bg-red-900 text-red-600 dark:text-red-300', | |
| responses: [ | |
| "Growth occurs when one goes beyond one's limits. Realizing that is also part of training.", | |
| "You don't become the Hokage to be acknowledged by everyone. The one who is acknowledged by everyone becomes the Hokage.", | |
| "People's lives don't end when they die. It ends when they lose faith. Keep your faith strong." | |
| ] | |
| } | |
| }; | |
| // Language Translations | |
| const translations = { | |
| en: { | |
| mainTitle: "Choose Your Mentor", | |
| welcomeMessage: "Select a mentor to start your conversation", | |
| settingsTitle: "Settings", | |
| languageSetting: "Language", | |
| languageDescription: "App language", | |
| resetConversations: "Reset Conversations", | |
| resetDescription: "Clear all saved chat history", | |
| resetButton: "Reset Now", | |
| aboutCharacters: "About Characters", | |
| cristianoBio: "Football legend known for discipline, hard work, and relentless pursuit of excellence.", | |
| elonBio: "Visionary entrepreneur focused on innovation, risk-taking, and pushing boundaries.", | |
| erenBio: "Driven by intense emotions and unwavering determination to achieve freedom.", | |
| itachiBio: "Philosophical ninja who values sacrifice, wisdom, and seeing the bigger picture." | |
| }, | |
| ar: { | |
| mainTitle: "اختر مرشدك", | |
| welcomeMessage: "اختر مرشدًا لبدء المحادثة", | |
| settingsTitle: "الإعدادات", | |
| languageSetting: "اللغة", | |
| languageDescription: "لغة التطبيق", | |
| resetConversations: "إعادة تعيين المحادثات", | |
| resetDescription: "مسح كل سجل المحادثات المحفوظ", | |
| resetButton: "إعادة تعيين الآن", | |
| aboutCharacters: "حول الشخصيات", | |
| cristianoBio: "أسطورة كرة القدم المعروفة بالانضباط والعمل الجاد والسعي الدؤوب للتميز.", | |
| elonBio: "رجل أعمال ذو رؤية يركز على الابتكار والمخاطرة ودفع الحدود.", | |
| erenBio: "مدفوع بمشاعر شديدة وتصميم لا يتزعزع لتحقيق الحرية.", | |
| itachiBio: "نينجا فلسفي يقدر التضحية والحكمة ورؤية الصورة الأكبر." | |
| } | |
| }; | |
| // Initialize the app | |
| function initApp() { | |
| // Check for saved language preference | |
| const savedLanguage = localStorage.getItem('language'); | |
| if (savedLanguage) { | |
| currentLanguage = savedLanguage; | |
| languageToggle.checked = savedLanguage === 'ar'; | |
| settingsLanguageToggle.checked = savedLanguage === 'ar'; | |
| updateLanguageUI(); | |
| } | |
| // Set up event listeners | |
| setupEventListeners(); | |
| } | |
| // Set up all event listeners | |
| function setupEventListeners() { | |
| // Navigation | |
| settingsBtn.addEventListener('click', () => { | |
| homeScreen.classList.remove('active'); | |
| chatScreen.classList.remove('active'); | |
| settingsScreen.classList.add('active'); | |
| }); | |
| backBtn.addEventListener('click', () => { | |
| chatScreen.classList.remove('active'); | |
| homeScreen.classList.add('active'); | |
| }); | |
| backSettingsBtn.addEventListener('click', () => { | |
| settingsScreen.classList.remove('active'); | |
| homeScreen.classList.add('active'); | |
| }); | |
| // Language toggles | |
| languageToggle.addEventListener('change', updateLanguage); | |
| settingsLanguageToggle.addEventListener('change', updateLanguage); | |
| // Character selection | |
| characterCards.forEach(card => { | |
| card.addEventListener('click', function() { | |
| const characterId = this.getAttribute('data-character'); | |
| selectCharacter(characterId); | |
| }); | |
| }); | |
| // Message sending | |
| sendMessageBtn.addEventListener('click', sendMessage); | |
| messageInput.addEventListener('keypress', function(e) { | |
| if (e.key === 'Enter') { | |
| sendMessage(); | |
| } | |
| }); | |
| // Reset conversations | |
| resetBtn.addEventListener('click', resetConversations); | |
| } | |
| // Update language | |
| function updateLanguage() { | |
| currentLanguage = this.checked ? 'ar' : 'en'; | |
| if (this.id === 'languageToggle') { | |
| settingsLanguageToggle.checked = this.checked; | |
| } else { | |
| languageToggle.checked = this.checked; | |
| } | |
| localStorage.setItem('language', currentLanguage); | |
| updateLanguageUI(); | |
| // Update document direction for RTL languages | |
| document.documentElement.dir = currentLanguage === 'ar' ? 'rtl' : 'ltr'; | |
| } | |
| // Update all UI elements with current language | |
| function updateLanguageUI() { | |
| const lang = translations[currentLanguage]; | |
| // Update all text elements | |
| for (const [key, element] of Object.entries(textElements)) { | |
| if (element) element.textContent = lang[key]; | |
| } | |
| } | |
| // Select a character | |
| function selectCharacter(characterId) { | |
| currentCharacter = characterId; | |
| const character = characters[characterId]; | |
| // Update character display | |
| currentCharacterName.textContent = character.name; | |
| currentCharacterIcon.innerHTML = ''; | |
| const icon = document.createElement('i'); | |
| icon.className = character.icon; | |
| currentCharacterIcon.className = `w-10 h-10 rounded-full ${character.iconColor} flex items-center justify-center mr-3`; | |
| currentCharacterIcon.appendChild(icon); | |
| // Switch to chat screen | |
| homeScreen.classList.remove('active'); | |
| chatScreen.classList.add('active'); | |
| // Clear chat and show welcome message | |
| chatContainer.innerHTML = ''; | |
| addCharacterMessage(`Hello! I'm ${character.name}. What would you like to discuss?`); | |
| // Enable input | |
| messageInput.disabled = false; | |
| sendMessageBtn.disabled = false; | |
| messageInput.focus(); | |
| } | |
| // Send message | |
| function sendMessage() { | |
| const messageText = messageInput.value.trim(); | |
| if (!messageText || !currentCharacter) return; | |
| // Add user message to chat | |
| addUserMessage(messageText); | |
| messageInput.value = ''; | |
| // Show typing indicator | |
| const typingIndicator = document.createElement('div'); | |
| typingIndicator.className = 'typing-indicator flex items-center p-3'; | |
| typingIndicator.innerHTML = ` | |
| <span></span> | |
| <span></span> | |
| <span></span> | |
| `; | |
| chatContainer.appendChild(typingIndicator); | |
| chatContainer.scrollTop = chatContainer.scrollHeight; | |
| // Simulate AI response after a delay | |
| setTimeout(() => { | |
| // Remove typing indicator | |
| chatContainer.removeChild(typingIndicator); | |
| // Get random response | |
| const responses = characters[currentCharacter].responses; | |
| const randomResponse = responses[Math.floor(Math.random() * responses.length)]; | |
| // Add character response | |
| addCharacterMessage(randomResponse); | |
| }, 1500); | |
| } | |
| // Add user message to chat | |
| function addUserMessage(text) { | |
| const messageDiv = document.createElement('div'); | |
| messageDiv.className = 'flex justify-end'; | |
| messageDiv.innerHTML = ` | |
| <div class="chat-bubble user-bubble px-4 py-2 mb-2"> | |
| ${text} | |
| </div> | |
| `; | |
| chatContainer.appendChild(messageDiv); | |
| chatContainer.scrollTop = chatContainer.scrollHeight; | |
| // Save message | |
| messages.push({ | |
| sender: 'user', | |
| text: text, | |
| timestamp: new Date().toISOString() | |
| }); | |
| } | |
| // Add character message to chat | |
| function addCharacterMessage(text) { | |
| const messageDiv = document.createElement('div'); | |
| messageDiv.className = 'flex justify-start items-start space-x-2'; | |
| messageDiv.innerHTML = ` | |
| <div class="w-8 h-8 rounded-full ${characters[currentCharacter].iconColor} flex items-center justify-center mt-1"> | |
| <i class="${characters[currentCharacter].icon}"></i> | |
| </div> | |
| <div class="chat-bubble character-bubble px-4 py-2 mb-2"> | |
| ${text} | |
| </div> | |
| `; | |
| chatContainer.appendChild(messageDiv); | |
| chatContainer.scrollTop = chatContainer.scrollHeight; | |
| // Save message | |
| messages.push({ | |
| sender: 'character', | |
| text: text, | |
| timestamp: new Date().toISOString() | |
| }); | |
| } | |
| // Reset conversations | |
| function resetConversations() { | |
| if (confirm(currentLanguage === 'en' ? | |
| "Are you sure you want to reset all conversations? This cannot be undone." : | |
| "هل أنت متأكد أنك تريد إعادة تعيين جميع المحادثات؟ لا يمكن التراجع عن هذا.")) { | |
| localStorage.removeItem('savedChats'); | |
| alert(currentLanguage === 'en' ? | |
| "All conversations have been reset." : | |
| "تم إعادة تعيين جميع المحادثات."); | |
| } | |
| } | |
| // Initialize the app | |
| initApp(); | |
| </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=lllerl/eux" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |