Dashboard Masticationpedia: differenze tra le versioni
Nessun oggetto della modifica |
Nessun oggetto della modifica |
||
| Riga 233: | Riga 233: | ||
refreshList(); | refreshList(); | ||
}); | }); | ||
</script> | |||
<script> | |||
// ✅ Correttore AI – funzione GLOBALE chiamata dal bottone "🔍 Controlla con AI" | |||
window.checkCodeAI = async function () { | |||
const codeEl = document.getElementById('codeArea'); | |||
const outEl = document.getElementById('consoleOutput'); | |||
if (!codeEl || !outEl) { alert('Manca #codeArea o #consoleOutput'); return; } | |||
const code = codeEl.value; | |||
const language = 'php'; // 🔁 cambia a "js", "python", "html", ecc. quando serve | |||
if (!code.trim()) { alert('Incolla del codice da analizzare.'); return; } | |||
outEl.textContent = '⏳ Invio al correttore AI…'; | |||
try { | |||
const r = await fetch('/dashboard/api/ai_check.php', { | |||
method: 'POST', | |||
headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' }, | |||
body: new URLSearchParams({ language, code }) | |||
}); | |||
const j = await r.json(); | |||
if (j.ok) { | |||
let txt = ''; | |||
if (j.lint && j.lint.trim()) { | |||
txt += '=== LINT ' + language.toUpperCase() + " ===\n" + j.lint + "\n\n"; | |||
} | |||
txt += (j.analysis || 'Nessun output.'); | |||
outEl.textContent = txt; | |||
} else { | |||
outEl.textContent = '❌ Errore: ' + (j.error || 'sconosciuto'); | |||
if (j.raw) outEl.textContent += '\n\nRAW:\n' + j.raw; | |||
} | |||
} catch (e) { | |||
outEl.textContent = '❌ Errore rete: ' + e.message; | |||
} | |||
}; | |||
</script> | </script> | ||
</html> | </html> | ||
Versione delle 14:24, 7 set 2025
🔧 Dashboard Operativa – Masticationpedia
Centro di comando per progetti, API, file e backup