Spaces:
Sleeping
Sleeping
Create template/index.html
Browse files- template/index.html +96 -0
template/index.html
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Maira Quintessence - Manual Control</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<style>
|
| 9 |
+
.glass { background: rgba(15, 23, 42, 0.8); backdrop-filter: blur(12px); border: 1px solid rgba(255, 255, 255, 0.1); }
|
| 10 |
+
.chat-scroll::-webkit-scrollbar { width: 5px; }
|
| 11 |
+
.chat-scroll::-webkit-scrollbar-thumb { background: #6366f1; border-radius: 10px; }
|
| 12 |
+
</style>
|
| 13 |
+
</head>
|
| 14 |
+
<body class="bg-[#0f172a] text-slate-200 min-h-screen flex items-center justify-center p-4">
|
| 15 |
+
<div class="w-full max-w-3xl h-[90vh] glass rounded-3xl flex flex-col overflow-hidden shadow-2xl">
|
| 16 |
+
|
| 17 |
+
<div class="p-5 border-b border-white/10 flex flex-wrap justify-between items-center gap-4">
|
| 18 |
+
<div>
|
| 19 |
+
<h1 class="text-xl font-bold text-indigo-400">Maira Neural Core</h1>
|
| 20 |
+
<p class="text-xs text-slate-500">Owner: CyberCoder225</p>
|
| 21 |
+
</div>
|
| 22 |
+
<select id="model-select" class="bg-slate-800 border border-white/20 rounded-lg px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-indigo-500">
|
| 23 |
+
<option value="small">Maira Lite (Fastest)</option>
|
| 24 |
+
<option value="medium">Maira Prime (Llama 3.2)</option>
|
| 25 |
+
<option value="qwen">Maira Logic (Analytical)</option>
|
| 26 |
+
<option value="danube">Maira Chat (Bubbly)</option>
|
| 27 |
+
<option value="granite">Maira Art (Creative/Large)</option>
|
| 28 |
+
</select>
|
| 29 |
+
</div>
|
| 30 |
+
|
| 31 |
+
<div id="chat-window" class="flex-grow p-6 overflow-y-auto chat-scroll space-y-4">
|
| 32 |
+
<div class="bg-indigo-500/10 border border-indigo-500/20 p-4 rounded-2xl rounded-tl-none max-w-[85%]">
|
| 33 |
+
Ready for orders, Boss. Which core should I engage?
|
| 34 |
+
</div>
|
| 35 |
+
</div>
|
| 36 |
+
|
| 37 |
+
<form id="chat-form" class="p-4 bg-slate-900/50 border-t border-white/10 flex gap-2">
|
| 38 |
+
<input type="text" id="user-input" placeholder="Type your message..." required
|
| 39 |
+
class="flex-grow bg-slate-800 border border-white/10 rounded-xl px-4 py-3 focus:outline-none focus:ring-2 focus:ring-indigo-500 transition-all">
|
| 40 |
+
<button type="submit" id="send-btn" class="bg-indigo-600 hover:bg-indigo-500 px-6 py-3 rounded-xl font-bold transition-all disabled:opacity-50">
|
| 41 |
+
Send
|
| 42 |
+
</button>
|
| 43 |
+
</form>
|
| 44 |
+
</div>
|
| 45 |
+
|
| 46 |
+
<script>
|
| 47 |
+
const chatWindow = document.getElementById('chat-window');
|
| 48 |
+
const chatForm = document.getElementById('chat-form');
|
| 49 |
+
const userInput = document.getElementById('user-input');
|
| 50 |
+
const modelSelect = document.getElementById('model-select');
|
| 51 |
+
const sendBtn = document.getElementById('send-btn');
|
| 52 |
+
|
| 53 |
+
function addMessage(role, text) {
|
| 54 |
+
const div = document.createElement('div');
|
| 55 |
+
div.className = role === 'user'
|
| 56 |
+
? 'bg-slate-700 ml-auto p-4 rounded-2xl rounded-tr-none max-w-[85%] text-white'
|
| 57 |
+
: 'bg-indigo-500/10 border border-indigo-500/20 p-4 rounded-2xl rounded-tl-none max-w-[85%]';
|
| 58 |
+
div.innerText = text;
|
| 59 |
+
chatWindow.appendChild(div);
|
| 60 |
+
chatWindow.scrollTop = chatWindow.scrollHeight;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
chatForm.onsubmit = async (e) => {
|
| 64 |
+
e.preventDefault();
|
| 65 |
+
const message = userInput.value.trim();
|
| 66 |
+
const model = modelSelect.value;
|
| 67 |
+
if (!message) return;
|
| 68 |
+
|
| 69 |
+
addMessage('user', message);
|
| 70 |
+
userInput.value = '';
|
| 71 |
+
sendBtn.disabled = true;
|
| 72 |
+
sendBtn.innerText = 'Thinking...';
|
| 73 |
+
|
| 74 |
+
try {
|
| 75 |
+
const response = await fetch('/chat', {
|
| 76 |
+
method: 'POST',
|
| 77 |
+
headers: { 'Content-Type': 'application/json' },
|
| 78 |
+
body: JSON.stringify({ message, model_type: model })
|
| 79 |
+
});
|
| 80 |
+
const data = await response.json();
|
| 81 |
+
|
| 82 |
+
if (data.maira) {
|
| 83 |
+
addMessage('maira', data.maira);
|
| 84 |
+
} else {
|
| 85 |
+
addMessage('maira', "Error: " + (data.error || "Unknown core failure"));
|
| 86 |
+
}
|
| 87 |
+
} catch (err) {
|
| 88 |
+
addMessage('maira', "Connection Lost. Is the backend still building?");
|
| 89 |
+
} finally {
|
| 90 |
+
sendBtn.disabled = false;
|
| 91 |
+
sendBtn.innerText = 'Send';
|
| 92 |
+
}
|
| 93 |
+
};
|
| 94 |
+
</script>
|
| 95 |
+
</body>
|
| 96 |
+
</html>
|