Spaces:
Running
Running
Thomas Heisig
<!DOCTYPE html> <html lang="de" data-theme="dark"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>KI Dashboard</title> <!-- Styles & Scripts --> <link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}"> <script src="{{ url_for('static', filename='script.js') }}" type="module" defer></script> <!-- Favicon & Libraries --> <link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}"> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> </head> <body> <!-- Header mit Login, Titel & Theme-Toggle --> <header> <h1>KI Dashboard</h1> <form id="login-form" class="header-login" autocomplete="off"> <input type="text" id="username" name="username" placeholder="Benutzer" required> <input type="password" id="password" name="password" placeholder="Passwort" required> <button type="submit">Login</button> <span id="login-status" class="status"></span> </form> <button id="theme-toggle" aria-label="Farbschema umschalten">🌓</button> </header> <main id="main" role="main"> <!-- MULTIMEDIA & EXTERNE QUELLEN (gemeinsame Kachel) --> <section id="input-sources-panel" class="panel"> <h2>Medien & Quellen</h2> <!-- Drag & Drop / Datei --> <div id="drop-zone" class="drop-zone">Datei hierher ziehen oder klicken</div> <input type="file" id="file-upload" accept="image/*,video/*,audio/*,.pdf,.txt" hidden> <!-- Kamera & Mikrofon --> <div class="media-controls"> <button id="mic-btn" aria-pressed="false">🎤 Mikrofon</button> <button id="cam-btn" aria-pressed="false">🎥 Kamera</button> </div> <video id="video-preview" autoplay muted playsinline hidden></video> <canvas id="photo-canvas" hidden></canvas> <!-- Wissensdienste --> <div class="source-buttons"> <button id="wiki-fetch">📚 Wikipedia</button> <button id="dict-fetch">🗒️ Wörterbuch</button> <button id="wolfram-fetch">📈 WolframAlpha</button> <button id="web-search">🔎 Websuche</button> </div> </section> <!-- CHAT --> <section id="chat-panel" class="panel"> <h2>KI Chat</h2> <div id="chat-box" aria-live="polite" aria-atomic="true"></div> <textarea id="chat-input" placeholder="Ihre Eingabe … (Enter = Senden, Shift+Enter = Zeilenumbruch)" rows="3" data-send-on-enter></textarea> <div class="token-counter">Tokens: <span id="token-counter">0</span></div> <div class="chat-controls"> <button id="send-btn" aria-label="Nachricht senden">Senden ⏎</button> <button id="clear-chat" aria-label="Chatverlauf löschen">Löschen 🗑️</button> </div> </section> <!-- PARAMETER & TRANSLATOR SETTINGS --> <section id="parameter-panel" class="panel"> <h2>Einstellungen</h2> <h3>Generierungsparameter</h3> <div class="param-row"> <label for="temperature">Temperatur:</label> <input type="range" min="0" max="1" step="0.05" id="temperature" value="0.7"><span id="temperature-val">0.7</span> </div> <div class="param-row"> <label for="max-tokens">Max Tokens:</label> <input type="number" id="max-tokens" value="512" min="64" max="4096"> </div> <div class="param-row"> <label for="top-p">Top-p:</label> <input type="number" min="0" max="1" step="0.05" id="top-p" value="1"><span>%</span> </div> <div class="param-row"> <label for="frequency-penalty">Freq-Penalty:</label> <input type="number" min="0" max="2" step="0.1" id="frequency-penalty" value="0"> </div> <div class="param-row"> <label for="presence-penalty">Pres-Penalty:</label> <input type="number" min="0" max="2" step="0.1" id="presence-penalty" value="0"> </div> <h3>Übersetzer</h3> <div class="param-row"> <label for="lang-from">Von:</label> <select id="lang-from"> <option value="auto">Auto</option> <option value="de">Deutsch</option> <option value="en">Englisch</option> <option value="fr">Französisch</option> <option value="es">Spanisch</option> </select> <label for="lang-to">Nach:</label> <select id="lang-to"> <option value="de">Deutsch</option> <option value="en" selected>Englisch</option> <option value="fr">Französisch</option> <option value="es">Spanisch</option> </select> </div> <h3>Optionen</h3> <label><input type="checkbox" id="streaming"> Streaming-Antwort</label> <label><input type="checkbox" id="log-prompts" checked> Logging aktiv</label> <label><input type="checkbox" id="expert-mode"> Experten-Modus</label> <button id="action-btn">Aktion ausführen</button> </section> <!-- PROMPT TUNING --> <section id="prompt-tuning" class="panel"> <h2>Prompt-Tuning</h2> <textarea id="tuning-prompt" placeholder="System- oder Rollen-Prompt hier eingeben …" rows="4"></textarea> <button id="tuning-submit">Prompt anwenden</button> </section> <!-- VISUALISIERUNG --> <section id="visual-output" class="panel"> <h2>KI Visualisierung</h2> <canvas id="usage-chart" height="200"></canvas> <div id="spacy-visual" class="spacy-box" aria-live="polite"></div> </section> <!-- VERLAUF / LOGGING --> <section id="log-view" class="panel"> <h2>Verlauf</h2> <ul id="log-list"></ul> <button id="download-log">Log herunterladen</button> </section> </main> <footer> <small>© 2025 KI Dashboard</small> </footer> <!-- Chat-Nachrichten-Vorlage --> <template id="msg-template"> <div class="msg <%= role %>"> <span class="msg-role"><%= roleLabel %></span> <div class="msg-content"><%= content %></div> </div> </template> </body> </html> - Initial Deployment
e9ec631 verified Download index.html from ThomasHeisig/ai-dashboard: direct link, hf CLI and curl.
- Browser
- Download file 32.5 kB
-
https://huggingface.co/spaces/ThomasHeisig/ai-dashboard/resolve/main/index.html
- Command line
-
hf download hf://spaces/ThomasHeisig/ai-dashboard/index.html
-
curl -L -o index.html https://huggingface.co/spaces/ThomasHeisig/ai-dashboard/resolve/main/index.html
32.5 kB
| <html lang="en" class="dark"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>AI Dashboard</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <style> | |
| .drop-zone { | |
| border: 2px dashed #3b82f6; | |
| transition: all 0.3s ease; | |
| } | |
| .drop-zone.active { | |
| border-color: #10b981; | |
| background-color: rgba(16, 185, 129, 0.1); | |
| } | |
| .chat-message { | |
| max-width: 80%; | |
| } | |
| .user-message { | |
| margin-left: auto; | |
| } | |
| .ai-message { | |
| margin-right: auto; | |
| } | |
| .panel { | |
| transition: all 0.3s ease; | |
| } | |
| .panel:hover { | |
| transform: translateY(-2px); | |
| box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); | |
| } | |
| #video-preview { | |
| max-height: 200px; | |
| } | |
| .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-100 dark:bg-gray-900 text-gray-800 dark:text-gray-200 min-h-screen transition-colors duration-300"> | |
| <div class="container mx-auto px-4 py-6"> | |
| <!-- Header --> | |
| <header class="flex flex-col md:flex-row justify-between items-center mb-8 gap-4"> | |
| <div class="flex items-center gap-4"> | |
| <h1 class="text-3xl font-bold bg-gradient-to-r from-blue-500 to-purple-600 bg-clip-text text-transparent"> | |
| <i class="fas fa-robot mr-2"></i>AI Dashboard | |
| </h1> | |
| <button id="theme-toggle" class="p-2 rounded-full bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors"> | |
| <i class="fas fa-moon dark:hidden"></i> | |
| <i class="fas fa-sun hidden dark:inline"></i> | |
| </button> | |
| </div> | |
| <form id="login-form" class="flex flex-col sm:flex-row gap-2 items-center"> | |
| <div class="relative"> | |
| <input type="text" id="username" placeholder="Username" required | |
| class="pl-8 pr-4 py-2 rounded-lg bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500"> | |
| <i class="fas fa-user absolute left-2 top-3 text-gray-400"></i> | |
| </div> | |
| <div class="relative"> | |
| <input type="password" id="password" placeholder="Password" required | |
| class="pl-8 pr-4 py-2 rounded-lg bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500"> | |
| <i class="fas fa-lock absolute left-2 top-3 text-gray-400"></i> | |
| </div> | |
| <button type="submit" class="px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors"> | |
| Login <i class="fas fa-sign-in-alt ml-1"></i> | |
| </button> | |
| <span id="login-status" class="text-sm hidden"></span> | |
| </form> | |
| </header> | |
| <main class="grid grid-cols-1 lg:grid-cols-3 gap-6"> | |
| <!-- Input Sources Panel --> | |
| <section class="panel bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 lg:col-span-1"> | |
| <h2 class="text-xl font-semibold mb-4 flex items-center gap-2"> | |
| <i class="fas fa-file-upload text-blue-500"></i> Media & Sources | |
| </h2> | |
| <div id="drop-zone" class="drop-zone p-8 rounded-lg text-center cursor-pointer mb-4 flex flex-col items-center justify-center gap-2"> | |
| <i class="fas fa-cloud-upload-alt text-3xl text-blue-500"></i> | |
| <p>Drag & drop files here or click to browse</p> | |
| <p class="text-sm text-gray-500">Supports: images, videos, audio, PDF, text</p> | |
| </div> | |
| <input type="file" id="file-upload" accept="image/*,video/*,audio/*,.pdf,.txt" class="hidden"> | |
| <div class="grid grid-cols-2 gap-3 mb-4"> | |
| <button id="mic-btn" class="flex items-center justify-center gap-2 p-3 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors"> | |
| <i class="fas fa-microphone"></i> Microphone | |
| </button> | |
| <button id="cam-btn" class="flex items-center justify-center gap-2 p-3 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors"> | |
| <i class="fas fa-camera"></i> Camera | |
| </button> | |
| </div> | |
| <video id="video-preview" autoplay muted playsinline class="w-full rounded-lg mb-4 hidden"></video> | |
| <canvas id="photo-canvas" class="hidden"></canvas> | |
| <h3 class="font-medium mb-2 flex items-center gap-2"> | |
| <i class="fas fa-database text-purple-500"></i> Knowledge Sources | |
| </h3> | |
| <div class="grid grid-cols-2 gap-3"> | |
| <button id="wiki-fetch" class="flex items-center justify-center gap-2 p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors"> | |
| <i class="fab fa-wikipedia-w"></i> Wikipedia | |
| </button> | |
| <button id="dict-fetch" class="flex items-center justify-center gap-2 p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors"> | |
| <i class="fas fa-book"></i> Dictionary | |
| </button> | |
| <button id="wolfram-fetch" class="flex items-center justify-center gap-2 p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors"> | |
| <i class="fas fa-square-root-alt"></i> WolframAlpha | |
| </button> | |
| <button id="web-search" class="flex items-center justify-center gap-2 p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors"> | |
| <i class="fas fa-search"></i> Web Search | |
| </button> | |
| </div> | |
| </section> | |
| <!-- Chat Panel --> | |
| <section class="panel bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 lg:col-span-2 flex flex-col"> | |
| <h2 class="text-xl font-semibold mb-4 flex items-center gap-2"> | |
| <i class="fas fa-comments text-green-500"></i> AI Chat | |
| </h2> | |
| <div id="chat-box" class="flex-1 overflow-y-auto mb-4 space-y-4 p-2" aria-live="polite"> | |
| <!-- Messages will appear here --> | |
| <div class="chat-message ai-message"> | |
| <div class="flex items-start gap-2"> | |
| <div class="bg-green-100 dark:bg-green-900 p-3 rounded-full"> | |
| <i class="fas fa-robot text-green-600 dark:text-green-300"></i> | |
| </div> | |
| <div class="bg-gray-100 dark:bg-gray-700 p-3 rounded-lg max-w-[80%]"> | |
| <p>Hello! I'm your AI assistant. How can I help you today?</p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="relative"> | |
| <textarea id="chat-input" rows="3" placeholder="Type your message here... (Enter to send, Shift+Enter for new line)" | |
| class="w-full p-3 rounded-lg bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500 resize-none"></textarea> | |
| <div class="absolute bottom-3 right-3 flex items-center gap-2"> | |
| <span id="token-counter" class="text-sm text-gray-500">0 tokens</span> | |
| <button id="send-btn" class="p-2 bg-blue-600 hover:bg-blue-700 text-white rounded-full transition-colors"> | |
| <i class="fas fa-paper-plane"></i> | |
| </button> | |
| </div> | |
| </div> | |
| <div class="flex justify-between mt-3"> | |
| <button id="clear-chat" class="px-3 py-1.5 rounded-lg bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors"> | |
| <i class="fas fa-trash-alt mr-1"></i> Clear Chat | |
| </button> | |
| <div class="flex gap-2"> | |
| <button class="px-3 py-1.5 rounded-lg bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors"> | |
| <i class="fas fa-history mr-1"></i> History | |
| </button> | |
| <button class="px-3 py-1.5 rounded-lg bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors"> | |
| <i class="fas fa-cog mr-1"></i> Settings | |
| </button> | |
| </div> | |
| </div> | |
| </section> | |
| <!-- Parameters Panel --> | |
| <section class="panel bg-white dark:bg-gray-800 rounded-xl shadow-md p-6"> | |
| <h2 class="text-xl font-semibold mb-4 flex items-center gap-2"> | |
| <i class="fas fa-sliders-h text-yellow-500"></i> Settings | |
| </h2> | |
| <h3 class="font-medium mb-3 flex items-center gap-2"> | |
| <i class="fas fa-cogs text-blue-400"></i> Generation Parameters | |
| </h3> | |
| <div class="space-y-4 mb-6"> | |
| <div> | |
| <label for="temperature" class="block text-sm font-medium mb-1">Temperature: <span id="temperature-val" class="font-bold">0.7</span></label> | |
| <input type="range" min="0" max="1" step="0.05" id="temperature" value="0.7" | |
| class="w-full h-2 bg-gray-200 dark:bg-gray-700 rounded-lg appearance-none cursor-pointer"> | |
| </div> | |
| <div> | |
| <label for="max-tokens" class="block text-sm font-medium mb-1">Max Tokens</label> | |
| <input type="number" id="max-tokens" value="512" min="64" max="4096" | |
| class="w-full p-2 rounded-lg bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500"> | |
| </div> | |
| <div> | |
| <label for="top-p" class="block text-sm font-medium mb-1">Top-p Sampling</label> | |
| <input type="number" min="0" max="1" step="0.05" id="top-p" value="1" | |
| class="w-full p-2 rounded-lg bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500"> | |
| </div> | |
| <div class="grid grid-cols-2 gap-4"> | |
| <div> | |
| <label for="frequency-penalty" class="block text-sm font-medium mb-1">Frequency Penalty</label> | |
| <input type="number" min="0" max="2" step="0.1" id="frequency-penalty" value="0" | |
| class="w-full p-2 rounded-lg bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500"> | |
| </div> | |
| <div> | |
| <label for="presence-penalty" class="block text-sm font-medium mb-1">Presence Penalty</label> | |
| <input type="number" min="0" max="2" step="0.1" id="presence-penalty" value="0" | |
| class="w-full p-2 rounded-lg bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500"> | |
| </div> | |
| </div> | |
| </div> | |
| <h3 class="font-medium mb-3 flex items-center gap-2"> | |
| <i class="fas fa-language text-purple-400"></i> Translator | |
| </h3> | |
| <div class="grid grid-cols-2 gap-4 mb-6"> | |
| <div> | |
| <label for="lang-from" class="block text-sm font-medium mb-1">From</label> | |
| <select id="lang-from" | |
| class="w-full p-2 rounded-lg bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500"> | |
| <option value="auto">Auto Detect</option> | |
| <option value="de">German</option> | |
| <option value="en">English</option> | |
| <option value="fr">French</option> | |
| <option value="es">Spanish</option> | |
| </select> | |
| </div> | |
| <div> | |
| <label for="lang-to" class="block text-sm font-medium mb-1">To</label> | |
| <select id="lang-to" | |
| class="w-full p-2 rounded-lg bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500"> | |
| <option value="de">German</option> | |
| <option value="en" selected>English</option> | |
| <option value="fr">French</option> | |
| <option value="es">Spanish</option> | |
| </select> | |
| </div> | |
| </div> | |
| <h3 class="font-medium mb-3 flex items-center gap-2"> | |
| <i class="fas fa-toggle-on text-green-400"></i> Options | |
| </h3> | |
| <div class="space-y-2 mb-6"> | |
| <label class="flex items-center gap-2 cursor-pointer"> | |
| <input type="checkbox" id="streaming" class="rounded text-blue-600 focus:ring-blue-500"> | |
| <span>Streaming Response</span> | |
| </label> | |
| <label class="flex items-center gap-2 cursor-pointer"> | |
| <input type="checkbox" id="log-prompts" checked class="rounded text-blue-600 focus:ring-blue-500"> | |
| <span>Enable Logging</span> | |
| </label> | |
| <label class="flex items-center gap-2 cursor-pointer"> | |
| <input type="checkbox" id="expert-mode" class="rounded text-blue-600 focus:ring-blue-500"> | |
| <span>Expert Mode</span> | |
| </label> | |
| </div> | |
| <button id="action-btn" class="w-full py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors"> | |
| Apply Settings <i class="fas fa-check ml-1"></i> | |
| </button> | |
| </section> | |
| <!-- Prompt Tuning --> | |
| <section class="panel bg-white dark:bg-gray-800 rounded-xl shadow-md p-6"> | |
| <h2 class="text-xl font-semibold mb-4 flex items-center gap-2"> | |
| <i class="fas fa-magic text-purple-500"></i> Prompt Tuning | |
| </h2> | |
| <textarea id="tuning-prompt" rows="6" placeholder="Enter your system or role prompt here..." | |
| class="w-full p-3 rounded-lg bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500 mb-4 resize-none"></textarea> | |
| <div class="grid grid-cols-2 gap-3 mb-4"> | |
| <button class="flex items-center justify-center gap-2 p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors"> | |
| <i class="fas fa-lightbulb"></i> Creative | |
| </button> | |
| <button class="flex items-center justify-center gap-2 p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors"> | |
| <i class="fas fa-balance-scale"></i> Neutral | |
| </button> | |
| <button class="flex items-center justify-center gap-2 p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors"> | |
| <i class="fas fa-graduation-cap"></i> Teacher | |
| </button> | |
| <button class="flex items-center justify-center gap-2 p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors"> | |
| <i class="fas fa-terminal"></i> Developer | |
| </button> | |
| </div> | |
| <button id="tuning-submit" class="w-full py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg transition-colors"> | |
| Apply Prompt <i class="fas fa-check ml-1"></i> | |
| </button> | |
| </section> | |
| <!-- Visualization --> | |
| <section class="panel bg-white dark:bg-gray-800 rounded-xl shadow-md p-6"> | |
| <h2 class="text-xl font-semibold mb-4 flex items-center gap-2"> | |
| <i class="fas fa-chart-line text-red-500"></i> AI Visualization | |
| </h2> | |
| <div class="h-48 mb-4"> | |
| <canvas id="usage-chart"></canvas> | |
| </div> | |
| <div id="spacy-visual" class="p-4 bg-gray-100 dark:bg-gray-700 rounded-lg h-48 overflow-y-auto"> | |
| <p class="text-center text-gray-500">Entity visualization will appear here</p> | |
| </div> | |
| </section> | |
| <!-- Log View --> | |
| <section class="panel bg-white dark:bg-gray-800 rounded-xl shadow-md p-6"> | |
| <h2 class="text-xl font-semibold mb-4 flex items-center gap-2"> | |
| <i class="fas fa-history text-blue-500"></i> History Log | |
| </h2> | |
| <ul id="log-list" class="space-y-2 max-h-96 overflow-y-auto"> | |
| <li class="p-2 bg-gray-100 dark:bg-gray-700 rounded-lg"> | |
| <div class="flex justify-between text-sm"> | |
| <span class="font-medium">System</span> | |
| <span class="text-gray-500">Just now</span> | |
| </div> | |
| <p class="text-sm">Dashboard initialized</p> | |
| </li> | |
| </ul> | |
| <button id="download-log" class="w-full mt-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors"> | |
| Download Log <i class="fas fa-download ml-1"></i> | |
| </button> | |
| </section> | |
| </main> | |
| <footer class="mt-8 text-center text-gray-500 dark:text-gray-400 text-sm"> | |
| <p>© 2023 AI Dashboard | Powered by OpenAI, WolframAlpha & Wikipedia</p> | |
| </footer> | |
| </div> | |
| <script> | |
| // Theme Toggle | |
| document.getElementById('theme-toggle').addEventListener('click', () => { | |
| document.documentElement.classList.toggle('dark'); | |
| localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); | |
| }); | |
| // Initialize theme from localStorage | |
| if (localStorage.getItem('theme') === 'dark' || (!localStorage.getItem('theme') && window.matchMedia('(prefers-color-scheme: dark)').matches)) { | |
| document.documentElement.classList.add('dark'); | |
| } else { | |
| document.documentElement.classList.remove('dark'); | |
| } | |
| // Temperature slider value display | |
| const tempSlider = document.getElementById('temperature'); | |
| const tempValue = document.getElementById('temperature-val'); | |
| tempSlider.addEventListener('input', () => { | |
| tempValue.textContent = tempSlider.value; | |
| }); | |
| // Drop zone functionality | |
| const dropZone = document.getElementById('drop-zone'); | |
| const fileInput = document.getElementById('file-upload'); | |
| dropZone.addEventListener('click', () => fileInput.click()); | |
| ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => { | |
| dropZone.addEventListener(eventName, preventDefaults, false); | |
| }); | |
| function preventDefaults(e) { | |
| e.preventDefault(); | |
| e.stopPropagation(); | |
| } | |
| ['dragenter', 'dragover'].forEach(eventName => { | |
| dropZone.addEventListener(eventName, highlight, false); | |
| }); | |
| ['dragleave', 'drop'].forEach(eventName => { | |
| dropZone.addEventListener(eventName, unhighlight, false); | |
| }); | |
| function highlight() { | |
| dropZone.classList.add('active'); | |
| } | |
| function unhighlight() { | |
| dropZone.classList.remove('active'); | |
| } | |
| dropZone.addEventListener('drop', handleDrop, false); | |
| function handleDrop(e) { | |
| const dt = e.dataTransfer; | |
| const files = dt.files; | |
| handleFiles(files); | |
| } | |
| fileInput.addEventListener('change', () => { | |
| handleFiles(fileInput.files); | |
| }); | |
| function handleFiles(files) { | |
| console.log('Files uploaded:', files); | |
| // Here you would handle the file upload | |
| } | |
| // Camera and microphone functionality | |
| const micBtn = document.getElementById('mic-btn'); | |
| const camBtn = document.getElementById('cam-btn'); | |
| const videoPreview = document.getElementById('video-preview'); | |
| micBtn.addEventListener('click', async () => { | |
| try { | |
| const stream = await navigator.mediaDevices.getUserMedia({ audio: true }); | |
| console.log('Microphone access granted'); | |
| micBtn.innerHTML = '<i class="fas fa-microphone-slash"></i> Stop Mic'; | |
| micBtn.classList.remove('bg-gray-100', 'dark:bg-gray-700'); | |
| micBtn.classList.add('bg-red-100', 'dark:bg-red-900'); | |
| } catch (err) { | |
| console.error('Error accessing microphone:', err); | |
| } | |
| }); | |
| camBtn.addEventListener('click', async () => { | |
| try { | |
| const stream = await navigator.mediaDevices.getUserMedia({ video: true }); | |
| videoPreview.srcObject = stream; | |
| videoPreview.hidden = false; | |
| camBtn.innerHTML = '<i class="fas fa-video-slash"></i> Stop Cam'; | |
| camBtn.classList.remove('bg-gray-100', 'dark:bg-gray-700'); | |
| camBtn.classList.add('bg-red-100', 'dark:bg-red-900'); | |
| } catch (err) { | |
| console.error('Error accessing camera:', err); | |
| } | |
| }); | |
| // Chat functionality | |
| const chatBox = document.getElementById('chat-box'); | |
| const chatInput = document.getElementById('chat-input'); | |
| const sendBtn = document.getElementById('send-btn'); | |
| const clearChatBtn = document.getElementById('clear-chat'); | |
| const tokenCounter = document.getElementById('token-counter'); | |
| function addMessage(role, content) { | |
| const messageDiv = document.createElement('div'); | |
| messageDiv.className = `chat-message ${role}-message`; | |
| const icon = role === 'user' ? 'fa-user' : 'fa-robot'; | |
| const bgColor = role === 'user' ? 'bg-blue-100 dark:bg-blue-900' : 'bg-green-100 dark:bg-green-900'; | |
| const textColor = role === 'user' ? 'text-blue-600 dark:text-blue-300' : 'text-green-600 dark:text-green-300'; | |
| messageDiv.innerHTML = ` | |
| <div class="flex items-start gap-2 ${role === 'user' ? 'justify-end' : ''}"> | |
| ${role === 'user' ? '' : ` | |
| <div class="${bgColor} p-3 rounded-full"> | |
| <i class="fas ${icon} ${textColor}"></i> | |
| </div> | |
| `} | |
| <div class="${role === 'user' ? 'bg-blue-100 dark:bg-blue-900' : 'bg-gray-100 dark:bg-gray-700'} p-3 rounded-lg max-w-[80%]"> | |
| <p>${content}</p> | |
| </div> | |
| ${role === 'user' ? ` | |
| <div class="${bgColor} p-3 rounded-full"> | |
| <i class="fas ${icon} ${textColor}"></i> | |
| </div> | |
| ` : ''} | |
| </div> | |
| `; | |
| chatBox.appendChild(messageDiv); | |
| chatBox.scrollTop = chatBox.scrollHeight; | |
| // Update token counter (mock) | |
| const tokens = Math.floor(content.length / 4); | |
| tokenCounter.textContent = `${tokens} tokens`; | |
| } | |
| chatInput.addEventListener('keydown', (e) => { | |
| if (e.key === 'Enter' && !e.shiftKey) { | |
| e.preventDefault(); | |
| sendMessage(); | |
| } | |
| }); | |
| sendBtn.addEventListener('click', sendMessage); | |
| function sendMessage() { | |
| const message = chatInput.value.trim(); | |
| if (message) { | |
| addMessage('user', message); | |
| chatInput.value = ''; | |
| // Show typing indicator | |
| const typingDiv = document.createElement('div'); | |
| typingDiv.className = 'chat-message ai-message'; | |
| typingDiv.innerHTML = ` | |
| <div class="flex items-start gap-2"> | |
| <div class="bg-green-100 dark:bg-green-900 p-3 rounded-full"> | |
| <i class="fas fa-robot text-green-600 dark:text-green-300"></i> | |
| </div> | |
| <div class="bg-gray-100 dark:bg-gray-700 p-3 rounded-lg max-w-[80%]"> | |
| <div class="typing-indicator"> | |
| <span></span> | |
| <span></span> | |
| <span></span> | |
| </div> | |
| </div> | |
| </div> | |
| `; | |
| chatBox.appendChild(typingDiv); | |
| chatBox.scrollTop = chatBox.scrollHeight; | |
| // Simulate AI response after delay | |
| setTimeout(() => { | |
| chatBox.removeChild(typingDiv); | |
| const responses = [ | |
| "I understand your question. Here's what I can tell you about that topic...", | |
| "That's an interesting point! Based on my knowledge, I would suggest...", | |
| "I've analyzed your request and here's my response...", | |
| "Thanks for your message! Here's some information that might help..." | |
| ]; | |
| const randomResponse = responses[Math.floor(Math.random() * responses.length)]; | |
| addMessage('ai', randomResponse); | |
| }, 1500); | |
| } | |
| } | |
| clearChatBtn.addEventListener('click', () => { | |
| chatBox.innerHTML = ''; | |
| addMessage('ai', "Hello! I'm your AI assistant. How can I help you today?"); | |
| }); | |
| // Initialize chart | |
| const ctx = document.getElementById('usage-chart').getContext('2d'); | |
| const usageChart = new Chart(ctx, { | |
| type: 'line', | |
| data: { | |
| labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'], | |
| datasets: [{ | |
| label: 'API Usage (tokens)', | |
| data: [12000, 19000, 3000, 5000, 2000, 30000], | |
| borderColor: 'rgb(79, 70, 229)', | |
| backgroundColor: 'rgba(79, 70, 229, 0.1)', | |
| tension: 0.3, | |
| fill: true | |
| }] | |
| }, | |
| options: { | |
| responsive: true, | |
| maintainAspectRatio: false, | |
| plugins: { | |
| legend: { | |
| display: false | |
| } | |
| }, | |
| scales: { | |
| y: { | |
| beginAtZero: true | |
| } | |
| } | |
| } | |
| }); | |
| // Login form | |
| const loginForm = document.getElementById('login-form'); | |
| const loginStatus = document.getElementById('login-status'); | |
| loginForm.addEventListener('submit', (e) => { | |
| e.preventDefault(); | |
| const username = document.getElementById('username').value; | |
| const password = document.getElementById('password').value; | |
| // Mock login | |
| loginStatus.textContent = 'Logging in...'; | |
| loginStatus.classList.remove('hidden', 'text-red-500'); | |
| loginStatus.classList.add('text-blue-500'); | |
| setTimeout(() => { | |
| loginStatus.textContent = 'Login successful!'; | |
| loginStatus.classList.remove('text-blue-500'); | |
| loginStatus.classList.add('text-green-500'); | |
| setTimeout(() => { | |
| loginStatus.classList.add('hidden'); | |
| }, 2000); | |
| }, 1000); | |
| }); | |
| // Add sample log entries | |
| const logList = document.getElementById('log-list'); | |
| const logEntries = [ | |
| { type: 'System', message: 'Initialized dashboard components', time: '2 mins ago' }, | |
| { type: 'API', message: 'Connected to OpenAI service', time: '5 mins ago' }, | |
| { type: 'User', message: 'Changed temperature parameter to 0.8', time: '10 mins ago' }, | |
| { type: 'AI', message: 'Generated response to user query', time: '15 mins ago' } | |
| ]; | |
| logEntries.forEach(entry => { | |
| const li = document.createElement('li'); | |
| li.className = 'p-2 bg-gray-100 dark:bg-gray-700 rounded-lg'; | |
| li.innerHTML = ` | |
| <div class="flex justify-between text-sm"> | |
| <span class="font-medium">${entry.type}</span> | |
| <span class="text-gray-500">${entry.time}</span> | |
| </div> | |
| <p class="text-sm">${entry.message}</p> | |
| `; | |
| logList.appendChild(li); | |
| }); | |
| </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=superdigger/ai-dashboard" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |