| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="UTF-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| <title>AI Conversation Agent</title> |
| <script src="https://cdn.tailwindcss.com"></script> |
| <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> |
| <style> |
| @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap'); |
| |
| body { |
| font-family: 'Roboto', sans-serif; |
| background-color: #f5f5f5; |
| } |
| |
| .chat-bubble { |
| border-radius: 18px; |
| max-width: 80%; |
| } |
| |
| .user-bubble { |
| border-bottom-right-radius: 4px; |
| } |
| |
| .ai-bubble { |
| border-bottom-left-radius: 4px; |
| } |
| |
| .chat-container { |
| height: calc(100vh - 200px); |
| } |
| |
| @media (max-width: 768px) { |
| .sidebar { |
| transform: translateX(-100%); |
| transition: transform 0.3s ease; |
| } |
| |
| .sidebar.active { |
| transform: translateX(0); |
| } |
| |
| .overlay { |
| display: none; |
| position: fixed; |
| top: 0; |
| left: 0; |
| right: 0; |
| bottom: 0; |
| background-color: rgba(0,0,0,0.5); |
| z-index: 10; |
| } |
| |
| .overlay.active { |
| display: block; |
| } |
| } |
| </style> |
| </head> |
| <body class="bg-gray-100"> |
| <div class="flex h-screen overflow-hidden"> |
| |
| <div class="sidebar bg-white w-64 md:w-72 flex-shrink-0 shadow-md fixed md:relative z-20 h-full"> |
| <div class="p-4 border-b border-gray-200"> |
| <div class="flex items-center"> |
| <span class="material-icons text-blue-500 mr-2">smart_toy</span> |
| <h1 class="text-xl font-semibold text-gray-800">AI Assistant</h1> |
| </div> |
| </div> |
| |
| <div class="p-4"> |
| <button id="new-chat-btn" class="w-full flex items-center justify-center bg-blue-500 hover:bg-blue-600 text-white py-2 px-4 rounded-lg transition duration-200"> |
| <span class="material-icons mr-2">add</span> |
| New Chat |
| </button> |
| </div> |
| |
| <div class="overflow-y-auto h-3/5"> |
| <h3 class="px-4 py-2 text-gray-500 text-sm font-medium">Recent Conversations</h3> |
| <div id="chat-history" class="space-y-1 px-2"> |
| <div class="chat-item p-2 rounded-lg hover:bg-gray-100 cursor-pointer flex items-center"> |
| <span class="material-icons text-gray-500 mr-2">forum</span> |
| <span class="truncate">How to learn JavaScript</span> |
| </div> |
| <div class="chat-item p-2 rounded-lg hover:bg-gray-100 cursor-pointer flex items-center bg-gray-100"> |
| <span class="material-icons text-gray-500 mr-2">forum</span> |
| <span class="truncate">Best practices for React</span> |
| </div> |
| <div class="chat-item p-2 rounded-lg hover:bg-gray-100 cursor-pointer flex items-center"> |
| <span class="material-icons text-gray-500 mr-2">forum</span> |
| <span class="truncate">CSS Grid vs Flexbox</span> |
| </div> |
| <div class="chat-item p-2 rounded-lg hover:bg-gray-100 cursor-pointer flex items-center"> |
| <span class="material-icons text-gray-500 mr-2">forum</span> |
| <span class="truncate">Python data analysis</span> |
| </div> |
| </div> |
| </div> |
| |
| <div class="absolute bottom-0 left-0 right-0 p-4 border-t border-gray-200"> |
| <div class="flex items-center p-2 rounded-lg hover:bg-gray-100 cursor-pointer"> |
| <div class="w-8 h-8 rounded-full bg-blue-100 flex items-center justify-center"> |
| <span class="material-icons text-blue-500 text-sm">person</span> |
| </div> |
| <span class="ml-2 text-sm font-medium">User Account</span> |
| </div> |
| </div> |
| </div> |
| |
| |
| <div id="overlay" class="overlay"></div> |
| |
| |
| <div class="flex-1 flex flex-col h-full overflow-hidden"> |
| |
| <div class="md:hidden flex items-center justify-between p-4 bg-white shadow-sm"> |
| <button id="menu-btn" class="text-gray-600"> |
| <span class="material-icons">menu</span> |
| </button> |
| <h1 class="text-lg font-medium text-gray-800">AI Assistant</h1> |
| <div class="w-6"></div> |
| </div> |
| |
| |
| <div id="chat-container" class="chat-container flex-1 overflow-y-auto p-4 space-y-4"> |
| |
| <div class="flex items-start"> |
| <div class="w-8 h-8 rounded-full bg-blue-100 flex items-center justify-center mr-2 flex-shrink-0"> |
| <span class="material-icons text-blue-500 text-sm">smart_toy</span> |
| </div> |
| <div class="ai-bubble bg-white p-4 chat-bubble shadow-sm"> |
| <p class="text-gray-800">Hello! I'm your AI assistant. How can I help you today?</p> |
| <p class="text-gray-500 text-xs mt-2">You can ask me anything about technology, science, or general knowledge.</p> |
| </div> |
| </div> |
| |
| |
| <div class="flex items-start justify-end"> |
| <div class="user-bubble bg-blue-500 text-white p-4 chat-bubble shadow-sm"> |
| <p>What's the best way to learn JavaScript?</p> |
| </div> |
| </div> |
| |
| <div class="flex items-start"> |
| <div class="w-8 h-8 rounded-full bg-blue-100 flex items-center justify-center mr-2 flex-shrink-0"> |
| <span class="material-icons text-blue-500 text-sm">smart_toy</span> |
| </div> |
| <div class="ai-bubble bg-white p-4 chat-bubble shadow-sm"> |
| <p class="text-gray-800">Here are some effective ways to learn JavaScript:</p> |
| <ul class="list-disc pl-5 mt-2 space-y-1 text-gray-700"> |
| <li>Start with the basics (variables, functions, loops)</li> |
| <li>Build small projects to practice</li> |
| <li>Use interactive platforms like Codecademy or freeCodeCamp</li> |
| <li>Read documentation and developer blogs</li> |
| <li>Join coding communities for support</li> |
| </ul> |
| </div> |
| </div> |
| </div> |
| |
| |
| <div class="p-4 border-t border-gray-200 bg-white"> |
| <div class="flex items-center"> |
| <button class="p-2 text-gray-500 hover:text-gray-700 rounded-full hover:bg-gray-100"> |
| <span class="material-icons">attach_file</span> |
| </button> |
| <div class="flex-1 mx-2"> |
| <input id="user-input" type="text" placeholder="Type your message..." class="w-full p-3 rounded-full border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"> |
| </div> |
| <button id="send-btn" class="p-2 text-white bg-blue-500 rounded-full hover:bg-blue-600 transition duration-200"> |
| <span class="material-icons">send</span> |
| </button> |
| </div> |
| <p class="text-xs text-gray-500 mt-2 text-center">AI Assistant may produce inaccurate information. Consider verifying important information.</p> |
| </div> |
| </div> |
| </div> |
|
|
| <script> |
| |
| const menuBtn = document.getElementById('menu-btn'); |
| const sidebar = document.querySelector('.sidebar'); |
| const overlay = document.getElementById('overlay'); |
| |
| menuBtn.addEventListener('click', () => { |
| sidebar.classList.toggle('active'); |
| overlay.classList.toggle('active'); |
| }); |
| |
| overlay.addEventListener('click', () => { |
| sidebar.classList.remove('active'); |
| overlay.classList.remove('active'); |
| }); |
| |
| |
| const sendBtn = document.getElementById('send-btn'); |
| const userInput = document.getElementById('user-input'); |
| const chatContainer = document.getElementById('chat-container'); |
| const newChatBtn = document.getElementById('new-chat-btn'); |
| |
| sendBtn.addEventListener('click', sendMessage); |
| userInput.addEventListener('keypress', (e) => { |
| if (e.key === 'Enter') { |
| sendMessage(); |
| } |
| }); |
| |
| function sendMessage() { |
| const message = userInput.value.trim(); |
| if (message === '') return; |
| |
| |
| addMessageToChat(message, 'user'); |
| userInput.value = ''; |
| |
| |
| setTimeout(() => { |
| const responses = [ |
| "I understand your question about '" + message + "'. Let me think about that...", |
| "That's an interesting question. Here's what I know...", |
| "I can help with that! Here's some information...", |
| "Great question! The answer involves several considerations..." |
| ]; |
| const randomResponse = responses[Math.floor(Math.random() * responses.length)]; |
| addMessageToChat(randomResponse, 'ai'); |
| |
| |
| chatContainer.scrollTop = chatContainer.scrollHeight; |
| }, 1000); |
| } |
| |
| function addMessageToChat(message, sender) { |
| const messageDiv = document.createElement('div'); |
| messageDiv.className = `flex items-start ${sender === 'user' ? 'justify-end' : ''}`; |
| |
| if (sender === 'ai') { |
| messageDiv.innerHTML = ` |
| <div class="w-8 h-8 rounded-full bg-blue-100 flex items-center justify-center mr-2 flex-shrink-0"> |
| <span class="material-icons text-blue-500 text-sm">smart_toy</span> |
| </div> |
| <div class="ai-bubble bg-white p-4 chat-bubble shadow-sm"> |
| <p class="text-gray-800">${message}</p> |
| </div> |
| `; |
| } else { |
| messageDiv.innerHTML = ` |
| <div class="user-bubble bg-blue-500 text-white p-4 chat-bubble shadow-sm"> |
| <p>${message}</p> |
| </div> |
| `; |
| } |
| |
| chatContainer.appendChild(messageDiv); |
| chatContainer.scrollTop = chatContainer.scrollHeight; |
| } |
| |
| |
| newChatBtn.addEventListener('click', () => { |
| chatContainer.innerHTML = ` |
| <div class="flex items-start"> |
| <div class="w-8 h-8 rounded-full bg-blue-100 flex items-center justify-center mr-2 flex-shrink-0"> |
| <span class="material-icons text-blue-500 text-sm">smart_toy</span> |
| </div> |
| <div class="ai-bubble bg-white p-4 chat-bubble shadow-sm"> |
| <p class="text-gray-800">Hello! I'm your AI assistant. How can I help you today?</p> |
| <p class="text-gray-500 text-xs mt-2">You can ask me anything about technology, science, or general knowledge.</p> |
| </div> |
| </div> |
| `; |
| }); |
| |
| |
| document.querySelectorAll('.chat-item').forEach(item => { |
| item.addEventListener('click', function() { |
| |
| document.querySelectorAll('.chat-item').forEach(i => { |
| i.classList.remove('bg-gray-100'); |
| }); |
| |
| |
| this.classList.add('bg-gray-100'); |
| |
| |
| |
| chatContainer.innerHTML = ` |
| <div class="flex items-start"> |
| <div class="w-8 h-8 rounded-full bg-blue-100 flex items-center justify-center mr-2 flex-shrink-0"> |
| <span class="material-icons text-blue-500 text-sm">smart_toy</span> |
| </div> |
| <div class="ai-bubble bg-white p-4 chat-bubble shadow-sm"> |
| <p class="text-gray-800">Continuing our previous conversation about "${this.querySelector('span:last-child').textContent}"...</p> |
| </div> |
| </div> |
| `; |
| |
| |
| if (window.innerWidth < 768) { |
| sidebar.classList.remove('active'); |
| overlay.classList.remove('active'); |
| } |
| }); |
| }); |
| </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=abrarstudio07/ai-conversation-agent" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> |
| </html> |