Spaces:
Sleeping
Sleeping
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Maira Quintessence - Manual Control</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <style> | |
| .glass { background: rgba(15, 23, 42, 0.8); backdrop-filter: blur(12px); border: 1px solid rgba(255, 255, 255, 0.1); } | |
| .chat-scroll::-webkit-scrollbar { width: 5px; } | |
| .chat-scroll::-webkit-scrollbar-thumb { background: #6366f1; border-radius: 10px; } | |
| </style> | |
| </head> | |
| <body class="bg-[#0f172a] text-slate-200 min-h-screen flex items-center justify-center p-4"> | |
| <div class="w-full max-w-3xl h-[90vh] glass rounded-3xl flex flex-col overflow-hidden shadow-2xl"> | |
| <div class="p-5 border-b border-white/10 flex flex-wrap justify-between items-center gap-4"> | |
| <div> | |
| <h1 class="text-xl font-bold text-indigo-400">Maira Neural Core</h1> | |
| <p class="text-xs text-slate-500">Owner: CyberCoder225</p> | |
| </div> | |
| <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"> | |
| <option value="small">Maira Lite (Fastest)</option> | |
| <option value="medium">Maira Prime (Llama 3.2)</option> | |
| <option value="qwen">Maira Logic (Analytical)</option> | |
| <option value="danube">Maira Chat (Bubbly)</option> | |
| <option value="granite">Maira Art (Creative/Large)</option> | |
| </select> | |
| </div> | |
| <div id="chat-window" class="flex-grow p-6 overflow-y-auto chat-scroll space-y-4"> | |
| <div class="bg-indigo-500/10 border border-indigo-500/20 p-4 rounded-2xl rounded-tl-none max-w-[85%]"> | |
| Ready for orders, Boss. Which core should I engage? | |
| </div> | |
| </div> | |
| <form id="chat-form" class="p-4 bg-slate-900/50 border-t border-white/10 flex gap-2"> | |
| <input type="text" id="user-input" placeholder="Type your message..." required | |
| 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"> | |
| <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"> | |
| Send | |
| </button> | |
| </form> | |
| </div> | |
| <script> | |
| const chatWindow = document.getElementById('chat-window'); | |
| const chatForm = document.getElementById('chat-form'); | |
| const userInput = document.getElementById('user-input'); | |
| const modelSelect = document.getElementById('model-select'); | |
| const sendBtn = document.getElementById('send-btn'); | |
| function addMessage(role, text) { | |
| const div = document.createElement('div'); | |
| div.className = role === 'user' | |
| ? 'bg-slate-700 ml-auto p-4 rounded-2xl rounded-tr-none max-w-[85%] text-white' | |
| : 'bg-indigo-500/10 border border-indigo-500/20 p-4 rounded-2xl rounded-tl-none max-w-[85%]'; | |
| div.innerText = text; | |
| chatWindow.appendChild(div); | |
| chatWindow.scrollTop = chatWindow.scrollHeight; | |
| } | |
| chatForm.onsubmit = async (e) => { | |
| e.preventDefault(); | |
| const message = userInput.value.trim(); | |
| const model = modelSelect.value; | |
| if (!message) return; | |
| addMessage('user', message); | |
| userInput.value = ''; | |
| sendBtn.disabled = true; | |
| sendBtn.innerText = 'Thinking...'; | |
| try { | |
| const response = await fetch('/chat', { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify({ message, model_type: model }) | |
| }); | |
| const data = await response.json(); | |
| if (data.maira) { | |
| addMessage('maira', data.maira); | |
| } else { | |
| addMessage('maira', "Error: " + (data.error || "Unknown core failure")); | |
| } | |
| } catch (err) { | |
| addMessage('maira', "Connection Lost. Is the backend still building?"); | |
| } finally { | |
| sendBtn.disabled = false; | |
| sendBtn.innerText = 'Send'; | |
| } | |
| }; | |
| </script> | |
| </body> | |
| </html> |