Dashboard Masticationpedia: differenze tra le versioni
Nessun oggetto della modifica Etichetta: Annullato |
Nessun oggetto della modifica Etichetta: Annullato |
||
| Riga 1: | Riga 1: | ||
<!-- Pulsante | <html> | ||
<h2>🔧 Dashboard Operativa – Masticationpedia</h2> | |||
<!-- Pulsante --> | |||
<button id="btn-open-mpai" style="padding:.5rem .9rem;border:1px solid #ccc;border-radius:8px;cursor:pointer"> | |||
🤖 Masticationpedia AI | |||
</button> | |||
<!-- | <!-- Schermata AI nascosta --> | ||
<div id="mpAI" class="mpai-root" style="display:none"> | <div id="mpAI" class="mpai-root" style="display:none; margin-top:1rem; border:1px solid #e5e7eb; border-radius:12px; padding:12px;"> | ||
<div class="mpai-header"> | <div class="mpai-header"> | ||
<div class="mpai-title">🤖 Masticationpedia <b>AI</b> | <div class="mpai-title">🤖 Masticationpedia <b>AI</b></div> | ||
</div> | </div> | ||
<div id="mpai-chat" class="mpai-chat" style="border:1px solid #ccc; border-radius:8px; padding:10px; min-height:120px; margin:10px 0; background:#fff; overflow-y:auto; max-height:200px;"> | |||
<div | <div class="mpai-msg assistant"><b>GPT:</b> Benvenuto! Scrivi un messaggio qui sotto.</div> | ||
<div class="mpai-msg | |||
</div> | </div> | ||
<div class="mpai-composer" style="display:flex; gap:8px;"> | |||
<div class="mpai-composer"> | <textarea id="mpai-input" rows="2" style="flex:1; border:1px solid #ccc; border-radius:8px; padding:8px;"></textarea> | ||
<textarea id="mpai-input" rows=" | <button id="mpai-send" style="padding:.5rem .9rem; border:1px solid #0a7cff; border-radius:8px; background:#0a7cff; color:#fff; cursor:pointer">Invia</button> | ||
<button id="mpai-send" | |||
</div> | </div> | ||
</div> | </div> | ||
<style> | <style> | ||
.mpai-msg { margin:6px 0; padding:6px; border-radius:8px; } | |||
.mpai- | .mpai-msg.user { background:#eff6ff; border:1px solid #bee3f8; } | ||
.mpai-msg.assistant { background:#f0fdf4; border:1px solid #d1fae5; } | |||
.mpai- | |||
.mpai-msg.assistant{ | |||
</style> | </style> | ||
<script> | <script> | ||
(function(){ | document.addEventListener("DOMContentLoaded", function(){ | ||
const panel = document.getElementById("mpAI"); | |||
const chatEl = document.getElementById("mpai-chat"); | |||
const inputEl = document.getElementById("mpai-input"); | |||
const btnOpen = document.getElementById("btn-open-mpai"); | |||
const btnSend = document.getElementById("mpai-send"); | |||
// Apri la schermata AI | |||
btnOpen.onclick = () => { panel.style.display = "block"; }; | |||
function | // Aggiungi messaggio in chat | ||
function appendMsg(role, text){ | |||
const div = document.createElement("div"); | |||
div.className = "mpai-msg " + role; | |||
div.innerHTML = "<b>"+(role==="user"?"Tu":"GPT")+":</b> " + text; | |||
chatEl.appendChild( | chatEl.appendChild(div); | ||
chatEl.scrollTop = chatEl.scrollHeight; | chatEl.scrollTop = chatEl.scrollHeight; | ||
} | } | ||
// Invia messaggio | |||
btnSend.onclick = () => { | |||
if(! | const text = inputEl.value.trim(); | ||
if(!text) return; | |||
inputEl.value = | appendMsg("user", text); | ||
inputEl.value = ""; | |||
// Risposta finta (per test) | |||
setTimeout(()=> appendMsg("assistant", "Hai scritto: " + text), 600); | |||
}; | |||
}); | |||
} | |||
</script> | </script> | ||
< | </html> | ||
Versione delle 07:16, 28 set 2025
🔧 Dashboard Operativa – Masticationpedia