undefined / index.html
Port1k's picture
make the better design make better user interface , make the logo just empty circle , make cool website , improve the system
fc6cece verified
Raw History Blame Contribute Delete
20.7 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Zenh AI</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
:root {
--primary: #6e48aa;
--secondary: #9d50bb;
--accent: #4776e6;
--dark: #121212;
--darker: #0a0a0a;
--light: #f8f9fa;
--gray: #2d3748;
--light-gray: #4a5568;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
background: linear-gradient(135deg, var(--darker), var(--dark));
color: var(--light);
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
height: 100vh;
overflow: hidden;
line-height: 1.6;
}
.header {
display: flex;
align-items: center;
justify-content: center;
margin: 20px 0 30px;
gap: 15px;
}
.logo {
width: 48px;
height: 48px;
background: transparent;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
border: 2px solid var(--primary);
position: relative;
animation: pulse 3s infinite ease-in-out;
}
.logo::after {
content: '';
position: absolute;
width: 100%;
height: 100%;
border-radius: 50%;
border: 2px solid transparent;
border-top-color: var(--accent);
animation: spin 2s linear infinite;
}
@keyframes pulse {
0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(110, 72, 170, 0.4); }
50% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(110, 72, 170, 0); }
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
h1 {
margin: 0;
font-size: 28px;
font-weight: 700;
color: var(--light);
background: linear-gradient(to right, var(--primary), var(--accent));
-webkit-background-clip: text;
background-clip: text;
color: transparent;
letter-spacing: 0.5px;
}
#mode-selector {
display: flex;
justify-content: center;
margin-bottom: 25px;
gap: 15px;
}
.mode-button {
padding: 12px 24px;
background: linear-gradient(135deg, var(--dark), var(--gray));
color: var(--light);
border: none;
border-radius: 12px;
cursor: pointer;
transition: all 0.3s ease;
font-weight: 500;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
position: relative;
overflow: hidden;
z-index: 1;
}
.mode-button::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(135deg, var(--primary), var(--accent));
z-index: -1;
opacity: 0;
transition: opacity 0.3s ease;
}
.mode-button.active, .mode-button:hover {
color: white;
transform: translateY(-2px);
box-shadow: 0 6px 12px rgba(110, 72, 170, 0.3);
}
.mode-button.active::before, .mode-button:hover::before {
opacity: 1;
}
#mode-instructions {
text-align: center;
color: var(--light);
font-size: 14px;
margin-bottom: 25px;
padding: 15px;
background: rgba(30, 30, 30, 0.7);
border-radius: 12px;
opacity: 0;
transform: translateY(10px);
transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.1);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.1);
max-width: 800px;
margin-left: auto;
margin-right: auto;
width: 90%;
}
#mode-instructions.visible {
opacity: 1;
transform: translateY(0);
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}
#chat-container {
flex: 1;
overflow-y: auto;
padding: 25px;
border-radius: 20px;
background: rgba(25, 25, 25, 0.7);
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
margin-bottom: 20px;
scroll-behavior: smooth;
transition: all 0.5s ease;
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.1);
margin-left: auto;
margin-right: auto;
width: 95%;
max-width: 1000px;
}
#chat-container.fade {
opacity: 0.5;
filter: blur(2px);
}
.welcome-message {
text-align: center;
color: var(--light);
font-size: 20px;
margin-bottom: 40px;
opacity: 0;
transform: translateY(10px);
animation: fadeInUp 0.5s ease forwards;
font-weight: 300;
letter-spacing: 0.3px;
}
.quick-actions {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 15px;
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
.quick-button {
padding: 15px 20px;
background: rgba(40, 40, 40, 0.7);
color: var(--light);
border: none;
border-radius: 12px;
cursor: pointer;
font-size: 16px;
font-weight: 500;
transition: all 0.3s ease;
opacity: 0;
transform: translateY(10px);
animation: fadeInUp 0.3s ease forwards;
backdrop-filter: blur(5px);
border: 1px solid rgba(255, 255, 255, 0.1);
text-align: left;
position: relative;
overflow: hidden;
}
.quick-button::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(135deg, rgba(110, 72, 170, 0.3), rgba(71, 118, 230, 0.3));
z-index: -1;
opacity: 0;
transition: opacity 0.3s ease;
}
.quick-button:nth-child(1) { animation-delay: 0.1s; }
.quick-button:nth-child(2) { animation-delay: 0.2s; }
.quick-button:nth-child(3) { animation-delay: 0.3s; }
.quick-button:nth-child(4) { animation-delay: 0.4s; }
.quick-button:nth-child(5) { animation-delay: 0.5s; }
.quick-button:nth-child(6) { animation-delay: 0.6s; }
.quick-button:hover {
transform: translateY(-5px);
box-shadow: 0 10px 20px rgba(110, 72, 170, 0.3);
}
.quick-button:hover::before {
opacity: 1;
}
.message {
margin-bottom: 20px;
padding: 16px 20px;
border-radius: 16px;
opacity: 0;
transform: translateY(10px);
animation: fadeInUp 0.3s ease forwards;
max-width: 85%;
word-wrap: break-word;
line-height: 1.7;
position: relative;
transition: transform 0.3s ease;
}
.message:hover {
transform: translateY(-3px);
}
@keyframes fadeInUp {
to {
opacity: 1;
transform: translateY(0);
}
}
.user {
background: linear-gradient(135deg, var(--primary), var(--secondary));
color: white;
margin-left: auto;
text-align: right;
box-shadow: 0 4px 15px rgba(110, 72, 170, 0.3);
border: none;
}
.bot {
background: rgba(40, 40, 40, 0.7);
color: var(--light);
border: 1px solid rgba(255, 255, 255, 0.1);
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
backdrop-filter: blur(5px);
}
.processing-indicator {
display: flex;
align-items: center;
gap: 10px;
padding: 16px 20px;
background: rgba(40, 40, 40, 0.7);
border-radius: 16px;
border: 1px solid rgba(255, 255, 255, 0.1);
max-width: 85%;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
color: var(--light);
backdrop-filter: blur(5px);
}
.processing-dots {
display: flex;
gap: 4px;
}
.processing-dots span {
width: 8px;
height: 8px;
border-radius: 50%;
background: #ffffff;
animation: typing 1.4s infinite ease-in-out;
}
.processing-dots span:nth-child(1) { animation-delay: -0.32s; }
.processing-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes typing {
0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
40% { transform: scale(1); opacity: 1; }
}
#input-container {
display: flex;
gap: 15px;
padding: 0 25px;
margin: 0 auto 25px;
width: 95%;
max-width: 1000px;
}
#user-input {
flex: 1;
padding: 16px 20px;
border: 2px solid rgba(255, 255, 255, 0.1);
border-radius: 16px;
background: rgba(40, 40, 40, 0.7);
color: var(--light);
font-size: 16px;
outline: none;
transition: all 0.3s ease;
backdrop-filter: blur(5px);
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
#user-input:focus {
border-color: var(--accent);
box-shadow: 0 0 0 3px rgba(71, 118, 230, 0.2);
}
#user-input::placeholder {
color: rgba(255, 255, 255, 0.5);
}
#send-button {
padding: 16px 25px;
background: linear-gradient(135deg, var(--primary), var(--accent));
color: white;
border: none;
border-radius: 16px;
cursor: pointer;
font-size: 16px;
font-weight: 600;
transition: all 0.3s ease;
box-shadow: 0 4px 15px rgba(110, 72, 170, 0.4);
display: flex;
align-items: center;
gap: 8px;
}
#send-button:hover {
transform: translateY(-3px);
box-shadow: 0 10px 20px rgba(110, 72, 170, 0.4);
}
#send-button:active {
transform: translateY(0);
}
@media (max-width: 768px) {
body { padding: 15px; }
.header { margin: 10px 0 20px; }
h1 { font-size: 22px; }
#mode-selector { flex-wrap: wrap; }
.mode-button { padding: 10px 15px; font-size: 14px; }
#chat-container { padding: 15px; margin-bottom: 15px; width: 100%; }
#input-container { padding: 0 15px; margin-bottom: 15px; width: 100%; }
.quick-actions { grid-template-columns: 1fr; padding: 15px; }
.message, .processing-indicator { max-width: 90%; }
#user-input, #send-button { padding: 14px 18px; }
}
/* Scrollbar styling */
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: transparent;
}
::-webkit-scrollbar-thumb {
background: var(--primary);
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: var(--secondary);
}
</style>
</head>
<body>
<div class="header">
<div class="logo"></div>
<h1>CosmicAI Nexus</h1>
</div>
<div id="mode-selector">
<button class="mode-button active" data-mode="normal">Normal Chat</button>
<button class="mode-button" data-mode="thinking">Thinking Mode</button>
<button class="mode-button" data-mode="websearch">Web Search</button>
</div>
<div id="mode-instructions" class="visible"></div>
<div id="chat-container">
<div class="welcome-message">Welcome to Zenh AI! Select a mode and start chatting.</div>
<div class="quick-actions">
<button class="quick-button" onclick="quickAction('Tell me a cosmic joke.')">🌠 Cosmic Joke</button>
<button class="quick-button" onclick="quickAction('What is the weather like today?')">β›… Weather Check</button>
<button class="quick-button" onclick="quickAction('Explain quantum physics simply.')">πŸ”¬ Science Explainer</button>
<button class="quick-button" onclick="quickAction('Generate a poem about the universe.')">✨ Cosmic Poetry</button>
<button class="quick-button" onclick="quickAction('Help me with code: print Hello World in Python.')">πŸ’» Code Assistant</button>
<button class="quick-button" onclick="quickAction('Summarize the latest space discoveries.')">πŸš€ Space News</button>
</div>
</div>
<div id="input-container">
<input type="text" id="user-input" placeholder="Type your message..." onkeypress="handleKeyPress(event)">
<button id="send-button" onclick="sendMessage()">Send</button>
</div>
<script>
const API_KEY = 'YOUR_API_KEY_HERE'; // Replace with your actual API key
const MODEL = 'gpt-4'; // Updated to a more powerful model
const API_URL = 'https://openrouter.ai/api/v1/chat/completions';
const DDG_API = 'https://api.duckduckgo.com/';
let messages = [];
let currentMode = 'normal';
const modeInstructions = {
normal: '✨ Normal Chat Mode: Instant responses for everyday questions and conversations. Perfect for quick answers and casual chat.',
thinking: '🧠 Deep Thought Mode: The AI carefully analyzes and breaks down complex problems step-by-step. Ideal for detailed explanations and logical reasoning.',
websearch: '🌐 Web Search Mode: Real-time information from across the internet. The AI will search, summarize, and provide sources for up-to-date answers.'
};
function updateModeInstructions() {
const instructionsDiv = document.getElementById('mode-instructions');
instructionsDiv.textContent = modeInstructions[currentMode];
instructionsDiv.classList.add('visible');
}
function animateModeSwitch() {
const chatContainer = document.getElementById('chat-container');
chatContainer.classList.add('fade');
setTimeout(() => {
chatContainer.classList.remove('fade');
}, 500);
}
document.querySelectorAll('.mode-button').forEach(button => {
button.addEventListener('click', () => {
document.querySelectorAll('.mode-button').forEach(btn => btn.classList.remove('active'));
button.classList.add('active');
currentMode = button.dataset.mode;
updateModeInstructions();
animateModeSwitch();
});
});
updateModeInstructions(); // Initial
function addMessage(content, isUser) {
const chatContainer = document.getElementById('chat-container');
const welcome = chatContainer.querySelector('.welcome-message');
const quickActions = chatContainer.querySelector('.quick-actions');
if (welcome) welcome.style.display = 'none';
if (quickActions) quickActions.style.display = 'none';
const messageDiv = document.createElement('div');
messageDiv.classList.add('message', isUser ? 'user' : 'bot');
messageDiv.textContent = content;
chatContainer.appendChild(messageDiv);
chatContainer.scrollTop = chatContainer.scrollHeight;
}
function addProcessingIndicator(text) {
const chatContainer = document.getElementById('chat-container');
const processingDiv = document.createElement('div');
processingDiv.id = 'processing-indicator';
processingDiv.classList.add('processing-indicator');
processingDiv.innerHTML = `${text} <div class="processing-dots"><span></span><span></span><span></span></div>`;
chatContainer.appendChild(processingDiv);
chatContainer.scrollTop = chatContainer.scrollHeight;
}
function removeProcessingIndicator() {
const processingDiv = document.getElementById('processing-indicator');
if (processingDiv) {
processingDiv.remove();
}
}
function quickAction(prompt) {
document.getElementById('user-input').value = prompt;
sendMessage();
}
async function handleWebSearch(query) {
addProcessingIndicator('Searching...');
try {
const response = await fetch(`${DDG_API}?q=${encodeURIComponent(query)}&format=json`);
const data = await response.json();
let result = data.Abstract || 'No direct answer found. Here are related topics:\n';
if (data.RelatedTopics && data.RelatedTopics.length > 0) {
data.RelatedTopics.slice(0, 5).forEach(topic => {
result += `- ${topic.Text}: ${topic.FirstURL}\n`;
});
}
removeProcessingIndicator();
addMessage(result, false);
} catch (error) {
removeProcessingIndicator();
addMessage('Error during search: ' + error.message, false);
}
}
async function sendMessage() {
const input = document.getElementById('user-input');
const userMessage = input.value.trim();
if (!userMessage) return;
addMessage(userMessage, true);
input.value = '';
if (currentMode === 'websearch') {
await handleWebSearch(userMessage);
return;
}
let systemPrompt = '';
let indicatorText = 'Responding...';
if (currentMode === 'thinking') {
systemPrompt = 'Think step by step before responding. ';
indicatorText = 'Thinking...';
}
messages.push({ role: 'user', content: systemPrompt + userMessage });
addProcessingIndicator(indicatorText);
try {
const response = await fetch(API_URL, {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json',
'HTTP-Referer': window.location.origin,
'X-Title': 'Zenh AI'
},
body: JSON.stringify({
model: MODEL,
messages: messages,
max_tokens: 500,
temperature: 0.7
})
});
removeProcessingIndicator();
if (!response.ok) throw new Error(`API error: ${response.status}`);
const data = await response.json();
const botMessage = data.choices[0].message.content;
addMessage(botMessage, false);
messages.push({ role: 'assistant', content: botMessage });
} catch (error) {
removeProcessingIndicator();
addMessage('Error: ' + error.message, false);
}
}
function handleKeyPress(event) {
if (event.key === 'Enter') {
sendMessage();
}
}
</script>
</body>
</html>