Dashboard Masticationpedia: differenze tra le versioni
Nessun oggetto della modifica |
Nessun oggetto della modifica |
||
| Riga 131: | Riga 131: | ||
<!-- ========= SEZIONI LEGACY (nascoste) ========= --> | |||
<div id="api-settings" style="display:none; padding:1rem; border:1px solid #ccc; border-radius:8px; background:#f9f9f9;"> | |||
<strong>Connessione API (protetta dal server)</strong><br><br> | |||
<label>Modello</label> | |||
<select id="model-select" style="width:100%; margin-bottom:0.5rem;"> | |||
<option value="gpt-4o-2024-05-13" selected>gpt-4o-2024-05-13</option> | |||
<option value="gpt-4-turbo-2024-04-09">gpt-4-turbo-2024-04-09</option> | |||
</select> | |||
<label>Prompt di test</label> | |||
<textarea id="test_prompt" rows="3" style="width:100%; margin-bottom:0.5rem;"> | |||
Dimmi una curiosità sulla mandibola | |||
</textarea> | |||
<label style="display:inline-flex; gap:.4rem; align-items:center; margin:.25rem 0 .75rem;"> | |||
<input id="test_drop_urls" type="checkbox"> | |||
Ignora/Cancella URL e allegati per questo invio | |||
</label><br> | |||
<button id="test_run">Esegui</button> | |||
<pre id="api-result" style="background:#f0f0f0; padding:1rem; border:1px solid #ccc; margin-top:1rem; white-space:pre-wrap;"></pre> | |||
</div> | |||
<script> | |||
document.getElementById('test_run').addEventListener('click', async () => { | |||
const model = document.getElementById('model-select').value; | |||
const prompt = document.getElementById('test_prompt').value; | |||
const drop = document.getElementById('test_drop_urls').checked; | |||
const payload = { | |||
model, | |||
prompt, | |||
temperature: 0.7, // o leggi dalla tua UI | |||
drop_urls: drop, // << invia il flag al backend | |||
files: [], // no allegati nel test | |||
texts: [] | |||
}; | |||
try { | |||
const res = await fetch('/dashboard/api/openai_project_gpt.php', { | |||
method: 'POST', | |||
headers: { 'Content-Type': 'application/json' }, | |||
credentials: 'include', | |||
body: JSON.stringify(payload) | |||
}); | |||
const j = await res.json(); | |||
document.getElementById('api-result').textContent = JSON.stringify(j, null, 2); | |||
} catch (e) { | |||
document.getElementById('api-result').textContent = String(e); | |||
} | |||
}); | |||
</script> | |||
</html> | </html> | ||
Versione delle 14:48, 12 ott 2025
🔧 Dashboard Operativa – Masticationpedia
Centro di comando per progetti, API, file e backup