Nessun oggetto della modifica
Nessun oggetto della modifica
Riga 131: Riga 131:




  <!-- ========== SEZIONI LEGACY (nascoste) ========== -->
<!-- ========= SEZIONI LEGACY (nascoste) ========= -->
  <div id="api-settings" style="display:none; padding:1rem; border:1px solid #ccc; border-radius:8px; background:#f9f9f9;">
<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>
  <strong>Connessione API (protetta dal server)</strong><br><br>
    <label>Modello</label>
 
    <select id="model-select" style="width:100%; margin-bottom:0.5rem;">
  <label>Modello</label>
      <option value="gpt-4o-2024-05-13" selected>gpt-4o-2024-05-13</option>
  <select id="model-select" style="width:100%; margin-bottom:0.5rem;">
      <option value="gpt-4-turbo-2024-04-09">gpt-4-turbo-2024-04-09</option>
    <option value="gpt-4o-2024-05-13" selected>gpt-4o-2024-05-13</option>
    </select>
    <option value="gpt-4-turbo-2024-04-09">gpt-4-turbo-2024-04-09</option>
    <label>Prompt di test</label>
  </select>
    <textarea id="test-prompt" rows="3" style="width:100%; margin-bottom:0.5rem;">Dimmi una curiosità sulla mandibola</textarea><br>
 
    <button onclick="(async()=>{try{const r=await fetch('/dashboard/api/openai_project_gpt.php',{method:'POST',headers:{'Content-Type':'application/json'},credentials:'include',body:JSON.stringify({model:document.getElementById('model-select').value,prompt:document.getElementById('test-prompt').value})}); const j=await r.json(); document.getElementById('api-result').textContent=JSON.stringify(j,null,2);}catch(e){document.getElementById('api-result').textContent=e.message;}})()">▶️ Esegui</button>
  <label>Prompt di test</label>
    <pre id="api-result" style="background:#f0f0f0; padding:1rem; border:1px solid #ccc; margin-top:1rem; white-space:pre-wrap;"></pre>
  <textarea id="test_prompt" rows="3" style="width:100%; margin-bottom:0.5rem;">
  </div>
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

🧾 Apri Log Dashboard