chrome / index.html
kavyaganeshkumar's picture
undefined - Initial Deployment
7853e8c verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI Chatbot Interface</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>
/* Custom scrollbar */
.chat-container::-webkit-scrollbar {
width: 8px;
}
.chat-container::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 10px;
}
.chat-container::-webkit-scrollbar-thumb {
background: #cbd5e0;
border-radius: 10px;
}
.chat-container::-webkit-scrollbar-thumb:hover {
background: #a0aec0;
}
/* Animation for new messages */
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.message {
animation: fadeIn 0.3s ease-out;
}
/* Typing indicator animation */
@keyframes blink {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
.typing-dot {
animation: blink 1.5s infinite;
}
.typing-dot:nth-child(2) {
animation-delay: 0.2s;
}
.typing-dot:nth-child(3) {
animation-delay: 0.4s;
}
</style>
</head>
<body class="bg-gray-100 min-h-screen flex flex-col">
<header class="bg-indigo-600 text-white shadow-md">
<div class="container mx-auto px-4 py-4 flex items-center justify-between">
<div class="flex items-center space-x-3">
<i class="fas fa-robot text-2xl"></i>
<h1 class="text-xl font-bold">AI Assistant</h1>
</div>
<div class="flex space-x-4">
<button class="p-2 rounded-full hover:bg-indigo-500 transition">
<i class="fas fa-cog"></i>
</button>
<button class="p-2 rounded-full hover:bg-indigo-500 transition">
<i class="fas fa-question-circle"></i>
</button>
</div>
</div>
</header>
<main class="flex-grow container mx-auto px-4 py-6 flex flex-col">
<div class="bg-white rounded-xl shadow-lg overflow-hidden flex flex-col flex-grow max-w-4xl mx-auto w-full">
<!-- Chat messages container -->
<div class="chat-container flex-grow p-4 overflow-y-auto max-h-[70vh]">
<!-- Welcome message -->
<div class="message mb-4 flex">
<div class="flex-shrink-0 mr-3">
<div class="bg-indigo-100 text-indigo-800 rounded-full w-10 h-10 flex items-center justify-center">
<i class="fas fa-robot"></i>
</div>
</div>
<div class="flex-grow">
<div class="bg-indigo-50 rounded-lg p-3 inline-block">
<p class="font-medium text-indigo-800">AI Assistant</p>
<p class="text-gray-700">Hello! I'm your AI assistant. How can I help you today?</p>
</div>
<p class="text-xs text-gray-500 mt-1">Today at <span id="current-time"></span></p>
</div>
</div>
<!-- Sample conversation -->
<div class="message mb-4 flex justify-end">
<div class="flex-grow max-w-xs md:max-w-md lg:max-w-lg">
<div class="bg-indigo-600 text-white rounded-lg p-3 inline-block float-right">
<p class="text-sm">What can you do?</p>
</div>
<p class="text-xs text-gray-500 mt-1 text-right">Just now</p>
</div>
</div>
<div class="message mb-4 flex">
<div class="flex-shrink-0 mr-3">
<div class="bg-indigo-100 text-indigo-800 rounded-full w-10 h-10 flex items-center justify-center">
<i class="fas fa-robot"></i>
</div>
</div>
<div class="flex-grow">
<div class="bg-indigo-50 rounded-lg p-3 inline-block">
<p class="font-medium text-indigo-800">AI Assistant</p>
<p class="text-gray-700">I can answer questions, help with programming (including C language), explain concepts, and assist with various topics. Try asking me something!</p>
</div>
<p class="text-xs text-gray-500 mt-1">Just now</p>
</div>
</div>
<!-- Typing indicator (hidden by default) -->
<div id="typing-indicator" class="hidden mb-4 flex">
<div class="flex-shrink-0 mr-3">
<div class="bg-indigo-100 text-indigo-800 rounded-full w-10 h-10 flex items-center justify-center">
<i class="fas fa-robot"></i>
</div>
</div>
<div class="flex items-center bg-indigo-50 rounded-lg p-3">
<div class="flex space-x-1 px-2">
<div class="typing-dot w-2 h-2 bg-gray-500 rounded-full"></div>
<div class="typing-dot w-2 h-2 bg-gray-500 rounded-full"></div>
<div class="typing-dot w-2 h-2 bg-gray-500 rounded-full"></div>
</div>
</div>
</div>
</div>
<!-- Input area -->
<div class="border-t border-gray-200 p-4 bg-gray-50">
<form id="chat-form" class="flex space-x-2">
<div class="flex-grow relative">
<input
type="text"
id="user-input"
placeholder="Type your message here..."
class="w-full px-4 py-3 rounded-full border border-gray-300 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent"
autocomplete="off"
>
<button type="button" class="absolute right-3 top-3 text-gray-400 hover:text-indigo-600">
<i class="far fa-smile"></i>
</button>
</div>
<button
type="submit"
class="bg-indigo-600 text-white rounded-full w-12 h-12 flex items-center justify-center hover:bg-indigo-700 transition"
>
<i class="fas fa-paper-plane"></i>
</button>
</form>
<p class="text-xs text-gray-500 mt-2 text-center">This is a frontend demo. For C integration, you would need server-side processing.</p>
</div>
</div>
</main>
<footer class="bg-white border-t border-gray-200 py-4">
<div class="container mx-auto px-4 text-center text-gray-500 text-sm">
<p>AI Chatbot Interface Demo | Not connected to actual C backend</p>
</div>
</footer>
<script>
// Display current time in welcome message
const now = new Date();
const timeString = now.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
document.getElementById('current-time').textContent = timeString;
// Simple chat functionality
const chatForm = document.getElementById('chat-form');
const userInput = document.getElementById('user-input');
const chatContainer = document.querySelector('.chat-container');
const typingIndicator = document.getElementById('typing-indicator');
// Sample responses
const responses = [
"I understand you're asking about C programming. Would you like help with pointers, memory management, or something else?",
"That's an interesting question! Could you provide more details?",
"For C programming, remember to always initialize your variables and check for null pointers.",
"I can simulate what a C backend might respond with. In a real implementation, this would connect to your C program.",
"If this were connected to a C backend, it would process your input and return a response."
];
chatForm.addEventListener('submit', function(e) {
e.preventDefault();
const message = userInput.value.trim();
if (message) {
// Add user message to chat
addMessage(message, 'user');
userInput.value = '';
// Show typing indicator
typingIndicator.classList.remove('hidden');
chatContainer.scrollTop = chatContainer.scrollHeight;
// Simulate bot response after a delay
setTimeout(() => {
typingIndicator.classList.add('hidden');
const randomResponse = responses[Math.floor(Math.random() * responses.length)];
addMessage(randomResponse, 'bot');
}, 1000 + Math.random() * 2000); // Random delay between 1-3 seconds
}
});
function addMessage(text, sender) {
const now = new Date();
const timeString = now.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
if (sender === 'user') {
const messageHTML = `
<div class="message mb-4 flex justify-end">
<div class="flex-grow max-w-xs md:max-w-md lg:max-w-lg">
<div class="bg-indigo-600 text-white rounded-lg p-3 inline-block float-right">
<p class="text-sm">${text}</p>
</div>
<p class="text-xs text-gray-500 mt-1 text-right">${timeString}</p>
</div>
</div>
`;
chatContainer.insertAdjacentHTML('beforeend', messageHTML);
} else {
const messageHTML = `
<div class="message mb-4 flex">
<div class="flex-shrink-0 mr-3">
<div class="bg-indigo-100 text-indigo-800 rounded-full w-10 h-10 flex items-center justify-center">
<i class="fas fa-robot"></i>
</div>
</div>
<div class="flex-grow">
<div class="bg-indigo-50 rounded-lg p-3 inline-block">
<p class="font-medium text-indigo-800">AI Assistant</p>
<p class="text-gray-700">${text}</p>
</div>
<p class="text-xs text-gray-500 mt-1">${timeString}</p>
</div>
</div>
`;
chatContainer.insertAdjacentHTML('beforeend', messageHTML);
}
chatContainer.scrollTop = chatContainer.scrollHeight;
}
// Allow pressing Enter to submit (but Shift+Enter for new line)
userInput.addEventListener('keydown', function(e) {
if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault();
chatForm.dispatchEvent(new Event('submit'));
}
});
</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=kavyaganeshkumar/chrome" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>