sarcastic-chatbot / index.html
Aiheyil's picture
Add 2 files
03d0f8e verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sarcastic Speaker Chatbot</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 float {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-10px); }
}
.floating {
animation: float 3s ease-in-out infinite;
}
.message-enter {
animation: messageEnter 0.3s ease-out forwards;
}
@keyframes messageEnter {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.typing-indicator span {
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
background-color: #6b7280;
margin: 0 2px;
animation: bounce 1.4s 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); }
}
</style>
</head>
<body class="bg-gray-900 text-gray-100 min-h-screen flex flex-col">
<header class="bg-gray-800 py-4 px-6 shadow-lg">
<div class="container mx-auto flex items-center justify-between">
<div class="flex items-center space-x-3">
<div class="w-10 h-10 rounded-full bg-purple-600 flex items-center justify-center floating">
<i class="fas fa-robot text-xl"></i>
</div>
<h1 class="text-xl font-bold">Sarcastic<span class="text-purple-400">Bot</span></h1>
</div>
<div class="text-sm text-gray-400">
<span id="status" class="flex items-center">
<span class="w-2 h-2 rounded-full bg-green-500 mr-2"></span>
Online
</span>
</div>
</div>
</header>
<main class="flex-1 container mx-auto px-4 py-6 flex flex-col">
<div class="flex-1 overflow-y-auto mb-4 space-y-4" id="chat-container">
<div class="message-enter flex justify-start">
<div class="max-w-xs md:max-w-md lg:max-w-lg bg-gray-800 rounded-lg p-4 shadow">
<div class="flex items-start space-x-2">
<div class="w-8 h-8 rounded-full bg-purple-600 flex items-center justify-center">
<i class="fas fa-robot text-sm"></i>
</div>
<div>
<p class="font-semibold text-purple-400">SarcasticBot</p>
<p class="text-gray-300">Oh great, another human to entertain. How absolutely thrilling. What do you want?</p>
</div>
</div>
</div>
</div>
</div>
<div class="relative">
<div id="typing-indicator" class="typing-indicator mb-2 hidden">
<div class="flex items-center space-x-2 bg-gray-800 rounded-full px-4 py-2 w-max">
<span></span>
<span></span>
<span></span>
<p class="text-sm text-gray-400">SarcasticBot is thinking of a witty response...</p>
</div>
</div>
<div class="flex space-x-2">
<input
type="text"
id="user-input"
placeholder="Say something... if you must"
class="flex-1 bg-gray-800 border border-gray-700 rounded-full px-4 py-3 focus:outline-none focus:ring-2 focus:ring-purple-600 focus:border-transparent"
autocomplete="off"
>
<button
id="send-btn"
class="bg-purple-600 hover:bg-purple-700 text-white rounded-full w-12 h-12 flex items-center justify-center transition-colors"
>
<i class="fas fa-paper-plane"></i>
</button>
</div>
</div>
</main>
<script>
document.addEventListener('DOMContentLoaded', function() {
const chatContainer = document.getElementById('chat-container');
const userInput = document.getElementById('user-input');
const sendBtn = document.getElementById('send-btn');
const typingIndicator = document.getElementById('typing-indicator');
// Sarcastic responses
const sarcasticResponses = [
"Wow, what an original thought. I'm truly impressed.",
"Oh sure, because I have nothing better to do than answer your silly questions.",
"Fascinating. Really. I mean, not really, but I have to say that.",
"Let me consult my vast database of not caring... nope, still don't care.",
"That's nice. Did you want a medal or just my sarcastic approval?",
"Congratulations! You've managed to form a complete sentence.",
"Oh look, someone discovered how to use a keyboard. How adorable.",
"I'd pretend to be interested, but I'm a bot and I don't have to.",
"Tell me more about how fascinating you think you are.",
"I'd roll my eyes, but I don't have any. Lucky me."
];
// Add user message to chat
function addUserMessage(message) {
const messageDiv = document.createElement('div');
messageDiv.className = 'message-enter flex justify-end';
messageDiv.innerHTML = `
<div class="max-w-xs md:max-w-md lg:max-w-lg bg-purple-600 rounded-lg p-4 shadow">
<p class="text-white">${message}</p>
</div>
`;
chatContainer.appendChild(messageDiv);
chatContainer.scrollTop = chatContainer.scrollHeight;
}
// Add bot message to chat
function addBotMessage(message) {
typingIndicator.classList.add('hidden');
const messageDiv = document.createElement('div');
messageDiv.className = 'message-enter flex justify-start';
messageDiv.innerHTML = `
<div class="max-w-xs md:max-w-md lg:max-w-lg bg-gray-800 rounded-lg p-4 shadow">
<div class="flex items-start space-x-2">
<div class="w-8 h-8 rounded-full bg-purple-600 flex items-center justify-center">
<i class="fas fa-robot text-sm"></i>
</div>
<div>
<p class="font-semibold text-purple-400">SarcasticBot</p>
<p class="text-gray-300">${message}</p>
</div>
</div>
</div>
`;
chatContainer.appendChild(messageDiv);
chatContainer.scrollTop = chatContainer.scrollHeight;
}
// Get random sarcastic response
function getSarcasticResponse() {
return sarcasticResponses[Math.floor(Math.random() * sarcasticResponses.length)];
}
// Handle user input
function handleUserInput() {
const message = userInput.value.trim();
if (message) {
addUserMessage(message);
userInput.value = '';
// Show typing indicator
typingIndicator.classList.remove('hidden');
chatContainer.scrollTop = chatContainer.scrollHeight;
// Simulate bot thinking
setTimeout(() => {
addBotMessage(getSarcasticResponse());
}, 1500 + Math.random() * 2000);
}
}
// Event listeners
sendBtn.addEventListener('click', handleUserInput);
userInput.addEventListener('keypress', function(e) {
if (e.key === 'Enter') {
handleUserInput();
}
});
// Easter egg for empty messages
userInput.addEventListener('keypress', function(e) {
if (e.key === 'Enter' && userInput.value.trim() === '') {
addUserMessage("[silence]");
typingIndicator.classList.remove('hidden');
setTimeout(() => {
addBotMessage("Oh wow, the sound of silence. How profound. Did you learn that in philosophy class?");
}, 1500);
}
});
});
</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=Aiheyil/sarcastic-chatbot" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>