Esteams / esteams-ai.html
HenzHosting's picture
Upload 48 files
8aeb522 verified
<!DOCTYPE html>
<html lang="en">
<!-- Mirrored from es-teams-database2025.onrender.com/esteams-ai.html by HTTrack Website Copier/3.x [XR&CO'2017], Fri, 14 Feb 2025 22:35:13 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8" /><!-- /Added by HTTrack -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ES TEAMS AI Chat</title>
<!-- Tailwind CSS -->
<script src="../external.html?link=https://cdn.tailwindcss.com/"></script>
<!-- Google Fonts -->
<link href="../external.html?link=https://fonts.googleapis.com/css2?family=Inter:wght@400;600&amp;display=swap" rel="stylesheet">
<style>
body {
font-family: 'Inter', sans-serif;
}
/* Typing Animation */
.typing {
display: flex;
align-items: center;
}
.typing span {
width: 8px;
height: 8px;
background: white;
margin: 0 2px;
border-radius: 50%;
animation: typing 1.5s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
0%, 100% { opacity: 0.2; }
50% { opacity: 1; }
}
/* AI Text Animation */
.ai-text {
opacity: 0;
transform: translateX(100%);
animation: slide-in 1s forwards;
}
@keyframes slide-in {
to {
opacity: 1;
transform: translateX(0);
}
}
</style>
</head>
<body class="bg-gray-900 text-white flex items-center justify-center h-screen">
<div class="w-full max-w-lg bg-gray-800 p-6 rounded-lg shadow-md">
<h2 class="text-2xl font-bold text-center mb-4">π—ͺπ—˜π—Ÿπ—–π—’π— π—˜ 𝗧𝗒 π—˜π—¦ π—§π—˜π—”π— π—¦ π—”π—œ</h2>
<p class="text-center text-gray-400 mb-6">I am an Artificial Intelligence built by ES TEAMS TECH</p>
<div id="chat-box" class="space-y-4 max-h-96 overflow-y-auto p-2 bg-gray-700 rounded-lg">
<div class="flex items-start space-x-2">
<div class="bg-blue-600 p-3 rounded-lg text-white">
Hello! How can I help you today?
</div>
</div>
</div>
<div class="flex items-center mt-4">
<input id="user-input" type="text" placeholder="Type your message..."
class="flex-1 p-3 rounded-lg bg-gray-700 focus:ring-2 focus:ring-blue-500 focus:outline-none text-white"
oninput="toggleSendButton()">
<button id="send-button" onclick="sendMessage()"
class="ml-2 bg-blue-600 hover:bg-blue-700 px-4 py-2 rounded-lg text-white font-bold send-btn" disabled>
Send
</button>
</div>
</div>
<script>
function toggleSendButton() {
document.getElementById("send-button").disabled = document.getElementById("user-input").value.trim() === "";
}
function getRequestData() {
const requestData = JSON.parse(localStorage.getItem("requestData")) || { count: 0, timestamp: null };
return requestData;
}
function updateRequestData() {
const now = Date.now();
let requestData = getRequestData();
if (!requestData.timestamp || now - requestData.timestamp > 24 * 60 * 60 * 1000) {
requestData = { count: 0, timestamp: now }; // Reset after 24 hours
}
requestData.count += 1;
localStorage.setItem("requestData", JSON.stringify(requestData));
return requestData;
}
function getRemainingTime() {
const requestData = getRequestData();
if (!requestData.timestamp) return 0;
const elapsedTime = Date.now() - requestData.timestamp;
const remainingTime = 24 * 60 * 60 * 1000 - elapsedTime;
if (remainingTime <= 0) {
localStorage.removeItem("requestData"); // Clear the count when time reaches zero
return 0;
}
return remainingTime;
}
function formatTime(ms) {
const hours = Math.floor(ms / (1000 * 60 * 60));
const minutes = Math.floor((ms % (1000 * 60 * 60)) / (1000 * 60));
return `${hours} hours ${minutes} minutes`;
}
async function sendMessage() {
const query = document.getElementById("user-input").value.trim().toLowerCase();
if (!query) return;
const requestData = getRequestData();
if (requestData.count >= 50) {
const remainingTime = getRemainingTime();
addMessage(`Limit Exceeded, Kindly use ES TEAMS AI + or wait for ${formatTime(remainingTime)}`, "ai");
return;
}
updateRequestData();
addMessage(query, "user");
document.getElementById("user-input").value = "";
toggleSendButton();
const typingElement = addTypingAnimation();
try {
const creatorQuestions = [
"who created you", "when were you created", "who developed you", "who fixed you", "who trained you", "who pet you", "who organized you", "who coded you", "who grew you", "who took care of you", "when last were you created", "who made you", "who built you",
"who is your creator", "when were you built", "who is the developer", "who designed you", "when was your creation"
];
const responseMessage = creatorQuestions.some(q => query.includes(q))
? "I was built by ES TEAMS TECH on 1st Feb 2025."
: null;
if (responseMessage) {
removeTypingAnimation(typingElement);
addMessage(responseMessage, "ai");
return;
}
const apiUrl = `https://api.davidcyriltech.my.id/ai/chatbot?query=${encodeURIComponent(query)}`;
const response = await fetch(apiUrl);
const jsonData = await response.json();
removeTypingAnimation(typingElement);
addMessage(jsonData.result || "Sorry, I couldn't process your request.", "ai");
} catch (error) {
console.error("Error fetching API response:", error);
removeTypingAnimation(typingElement);
addMessage("An error occurred. Please try again later.", "ai");
}
}
function addMessage(text, sender) {
const chatBox = document.getElementById("chat-box");
const messageDiv = document.createElement("div");
messageDiv.classList.add("flex", "items-start", "space-x-2");
if (sender === "ai") {
messageDiv.innerHTML = `<div class="bg-blue-600 p-3 rounded-lg text-white">${text}</div>`;
} else {
messageDiv.classList.add("justify-end");
messageDiv.innerHTML = `<div class="bg-gray-500 p-3 rounded-lg text-white">${text}</div>`;
}
chatBox.appendChild(messageDiv);
chatBox.scrollTop = chatBox.scrollHeight;
}
function addTypingAnimation() {
const chatBox = document.getElementById("chat-box");
const typingDiv = document.createElement("div");
typingDiv.classList.add("typing", "space-x-1", "ml-2");
for (let i = 0; i < 3; i++) {
const dot = document.createElement("span");
dot.classList.add("bg-white", "w-2", "h-2", "rounded-full");
typingDiv.appendChild(dot);
}
chatBox.appendChild(typingDiv);
chatBox.scrollTop = chatBox.scrollHeight;
return typingDiv;
}
function removeTypingAnimation(element) {
if (element) element.remove();
}
</script>
</body>
<!-- Mirrored from es-teams-database2025.onrender.com/esteams-ai.html by HTTrack Website Copier/3.x [XR&CO'2017], Fri, 14 Feb 2025 22:35:13 GMT -->
</html>