UI: close buttons for search/Q&A results, bulk bar above table, pagination (100/page)
This commit is contained in:
+7
-7
@@ -14,12 +14,6 @@
|
|||||||
<button class=pri onclick=pick() title="mp4, mkv, mov, webm, wav, m4a, mp3">⬆ Carica video</button>
|
<button class=pri onclick=pick() title="mp4, mkv, mov, webm, wav, m4a, mp3">⬆ Carica video</button>
|
||||||
<!-- Hidden file input used by pick(). -->
|
<!-- Hidden file input used by pick(). -->
|
||||||
<input type=file id=up accept="video/*,audio/*,.mkv" hidden></div></header>
|
<input type=file id=up accept="video/*,audio/*,.mkv" hidden></div></header>
|
||||||
<!-- Bulk-action bar, shown only when recordings are checked (upd() in ui.js). -->
|
|
||||||
<div class=card id=bulk hidden><b id=bn></b><a onclick=selAll(1)>tutte</a><a onclick=selAll(0)>nessuna</a><span class=sep></span>
|
|
||||||
<button onclick=mergeSel() title="unisce in un solo video le registrazioni spuntate (stessa chiamata riavviata)">Unisci</button>
|
|
||||||
<select id=bf title="step da cui rielaborare"><option>audio<option>transcribe<option>diarize<option>speakers<option>shots<option>docs<option>report<option>memory<option>render</select><button onclick=bulkRun() title="rielabora le registrazioni spuntate dallo step scelto">Rielabora da qui</button>
|
|
||||||
<button class=del onclick=bulkDrop() title="elimina solo i file video, report e trascrizione restano">Elimina video</button>
|
|
||||||
<button class=del onclick=bulkDel()>Elimina tutto</button></div>
|
|
||||||
<!-- Drag-and-drop hint; ui.js also accepts drops anywhere on the page. -->
|
<!-- Drag-and-drop hint; ui.js also accepts drops anywhere on the page. -->
|
||||||
<div id=hint>Trascina qui un video o un audio di una riunione per elaborarlo.</div>
|
<div id=hint>Trascina qui un video o un audio di una riunione per elaborarlo.</div>
|
||||||
<!-- Upload progress card (send() in ui.js). -->
|
<!-- Upload progress card (send() in ui.js). -->
|
||||||
@@ -28,8 +22,14 @@
|
|||||||
<!-- Search over speech and screen text, plus Q&A over the meetings. -->
|
<!-- Search over speech and screen text, plus Q&A over the meetings. -->
|
||||||
<div class=card><div class=row><input id=q placeholder="Cerca nel parlato e sullo schermo"><button onclick=srch()>Cerca</button></div>
|
<div class=card><div class=row><input id=q placeholder="Cerca nel parlato e sullo schermo"><button onclick=srch()>Cerca</button></div>
|
||||||
<div id=sr></div><div class=row><input id=qa placeholder="Chiedi alle riunioni"><select id=llma title="modello per le risposte (stesso del report)" onchange="llmr.value=llma.value;setLlm()"></select><button class=pri id=ab onclick=ask()>Chiedi</button></div><div id=ar></div></div>
|
<div id=sr></div><div class=row><input id=qa placeholder="Chiedi alle riunioni"><select id=llma title="modello per le risposte (stesso del report)" onchange="llmr.value=llma.value;setLlm()"></select><button class=pri id=ab onclick=ask()>Chiedi</button></div><div id=ar></div></div>
|
||||||
|
<!-- Bulk-action bar, shown only when recordings are checked (upd() in ui.js). -->
|
||||||
|
<div class=card id=bulk hidden><b id=bn></b><a onclick=selAll(1)>tutte</a><a onclick=selAll(0)>nessuna</a><span class=sep></span>
|
||||||
|
<button onclick=mergeSel() title="unisce in un solo video le registrazioni spuntate (stessa chiamata riavviata)">Unisci</button>
|
||||||
|
<select id=bf title="step da cui rielaborare"><option>audio<option>transcribe<option>diarize<option>speakers<option>shots<option>docs<option>report<option>memory<option>render</select><button onclick=bulkRun() title="rielabora le registrazioni spuntate dallo step scelto">Rielabora da qui</button>
|
||||||
|
<button class=del onclick=bulkDrop() title="elimina solo i file video, report e trascrizione restano">Elimina video</button>
|
||||||
|
<button class=del onclick=bulkDel()>Elimina tutto</button></div>
|
||||||
<!-- Meetings table: rendered by tick() in ui.js. -->
|
<!-- Meetings table: rendered by tick() in ui.js. -->
|
||||||
<div class="card t"><table id=t></table></div></main>
|
<div class="card t"><table id=t></table></div><div id=pgr class=row style="justify-content:center"></div></main>
|
||||||
<!-- Preview and crop dialog (play() in ui.js). -->
|
<!-- Preview and crop dialog (play() in ui.js). -->
|
||||||
<dialog id=cdlg><div class=pgh><b id=ctitle></b><button onclick=cclose()>✕ chiudi</button></div>
|
<dialog id=cdlg><div class=pgh><b id=ctitle></b><button onclick=cclose()>✕ chiudi</button></div>
|
||||||
<video id=cv controls preload=metadata></video>
|
<video id=cv controls preload=metadata></video>
|
||||||
|
|||||||
+12
-4
@@ -7,16 +7,18 @@ const fmt=s=>{s=Math.round(s);return String(Math.floor(s/60)).padStart(2,"0")+":
|
|||||||
q.onkeydown=e=>{if(e.key=="Enter")srch()};
|
q.onkeydown=e=>{if(e.key=="Enter")srch()};
|
||||||
// Enter in the Q&A box asks the question.
|
// Enter in the Q&A box asks the question.
|
||||||
qa.onkeydown=e=>{if(e.key=="Enter")ask()};
|
qa.onkeydown=e=>{if(e.key=="Enter")ask()};
|
||||||
|
// Close button appended after results: clears the input and the result box.
|
||||||
|
const CLOSE=(i,o)=>`<div><button onclick="${i}.value='';${o}.innerHTML=''">✕ chiudi</button></div>`;
|
||||||
// Q&A: /ask answers from the meeting data. The model may take minutes to load on first use.
|
// Q&A: /ask answers from the meeting data. The model may take minutes to load on first use.
|
||||||
async function ask(){if(!qa.value)return;ar.innerHTML="<small>…avvio modelli / risposta (può richiedere qualche minuto)</small>";
|
async function ask(){if(!qa.value)return;ar.innerHTML="<small>…avvio modelli / risposta (può richiedere qualche minuto)</small>";
|
||||||
const r=await fetch("/ask?q="+encodeURIComponent(qa.value));if(!r.ok){ar.textContent=await r.text();return}const j=await r.json();
|
const r=await fetch("/ask?q="+encodeURIComponent(qa.value));if(!r.ok){ar.textContent=await r.text();return}const j=await r.json();
|
||||||
// Turn citation markers [n] into links to the matching report section; keep the marker if the source is missing.
|
// Turn citation markers [n] into links to the matching report section; keep the marker if the source is missing.
|
||||||
ar.innerHTML="<div>"+E(j.answer).replace(/\[(\d+)\]/g,(m,n)=>{const s=j.sources[n-1];return s?`<a href="/report?name=${s.name}#${s.anchor}" target=_blank>[${n}]</a>`:m})+"</div>"+
|
ar.innerHTML="<div>"+E(j.answer).replace(/\[(\d+)\]/g,(m,n)=>{const s=j.sources[n-1];return s?`<a href="/report?name=${s.name}#${s.anchor}" target=_blank>[${n}]</a>`:m})+"</div>"+
|
||||||
j.sources.map(s=>`<div><small>[${s.n}] ${E(s.date)} ${E(s.meeting)} — ${E(s.topic)} ${fmt(s.t)} (${s.kind}): ${E(s.text)}</small></div>`).join("")}
|
j.sources.map(s=>`<div><small>[${s.n}] ${E(s.date)} ${E(s.meeting)} — ${E(s.topic)} ${fmt(s.t)} (${s.kind}): ${E(s.text)}</small></div>`).join("")+CLOSE("qa","ar")}
|
||||||
// Search over speech and screen text (/search).
|
// Search over speech and screen text (/search).
|
||||||
async function srch(){if(!q.value){sr.innerHTML="";return}const j=await (await fetch("/search?q="+encodeURIComponent(q.value))).json();
|
async function srch(){if(!q.value){sr.innerHTML="";return}const j=await (await fetch("/search?q="+encodeURIComponent(q.value))).json();
|
||||||
// Speech hits: [meeting, seconds, speaker, text]. Screen hits: [meeting, seconds, speaker, text, shot file] and link to the screenshot.
|
// Speech hits: [meeting, seconds, speaker, text]. Screen hits: [meeting, seconds, speaker, text, shot file] and link to the screenshot.
|
||||||
sr.innerHTML=j.speech.map(r=>`<div>${E(r[0])} ${fmt(r[1])} ${E(r[2]||"")}: ${E(r[3])}</div>`).join("")+j.screen.map(r=>`<div>🖥 <a href="/shot?name=${r[0]}&file=shots/${r[4]}" target=_blank>${E(r[0])} ${fmt(r[1])}</a> ${E(r[2]||"")}: ${E(r[3])}</div>`).join("")}
|
sr.innerHTML=j.speech.map(r=>`<div>${E(r[0])} ${fmt(r[1])} ${E(r[2]||"")}: ${E(r[3])}</div>`).join("")+j.screen.map(r=>`<div>🖥 <a href="/shot?name=${r[0]}&file=shots/${r[4]}" target=_blank>${E(r[0])} ${fmt(r[1])}</a> ${E(r[2]||"")}: ${E(r[3])}</div>`).join("")+CLOSE("q","sr")}
|
||||||
// Start a pipeline run from the chosen step (/run); 409 means it is already running.
|
// Start a pipeline run from the chosen step (/run); 409 means it is already running.
|
||||||
async function run(n){const f=document.getElementById("f-"+n).value;const r=await fetch(`/run?name=${n}&from=${f}`,{method:"POST"});if(r.status==409)alert("già in esecuzione");tick()}
|
async function run(n){const f=document.getElementById("f-"+n).value;const r=await fetch(`/run?name=${n}&from=${f}`,{method:"POST"});if(r.status==409)alert("già in esecuzione");tick()}
|
||||||
// Names of the checked recording rows (.mg checkboxes).
|
// Names of the checked recording rows (.mg checkboxes).
|
||||||
@@ -166,6 +168,9 @@ addEventListener("dragover",e=>{e.preventDefault();document.body.classList.add("
|
|||||||
addEventListener("dragleave",e=>{if(!e.relatedTarget)document.body.classList.remove("drag")});
|
addEventListener("dragleave",e=>{if(!e.relatedTarget)document.body.classList.remove("drag")});
|
||||||
// Drop anywhere on the page: upload the first file.
|
// Drop anywhere on the page: upload the first file.
|
||||||
addEventListener("drop",e=>{e.preventDefault();document.body.classList.remove("drag");const f=e.dataTransfer.files[0];if(f)send(f)});
|
addEventListener("drop",e=>{e.preventDefault();document.body.classList.remove("drag");const f=e.dataTransfer.files[0];if(f)send(f)});
|
||||||
|
// Meetings per page and current page index (0-based); goPg changes page and re-renders.
|
||||||
|
const PS=100;let pg_=0;
|
||||||
|
function goPg(d){pg_+=d;tick()}
|
||||||
// Refresh the whole UI from /status: header, LLM pickers, table.
|
// Refresh the whole UI from /status: header, LLM pickers, table.
|
||||||
async function tick(){try{const j=await (await fetch("/status")).json();ab.disabled=j.ask_blocked;ab.title=j.ask_blocked?"pipeline in corso":"";
|
async function tick(){try{const j=await (await fetch("/status")).json();ab.disabled=j.ask_blocked;ab.title=j.ask_blocked?"pipeline in corso":"";
|
||||||
// Browser tab title shows the progress of the first running pipeline.
|
// Browser tab title shows the progress of the first running pipeline.
|
||||||
@@ -182,8 +187,11 @@ qs.textContent=j.queue?`rielaborazione: ${j.queue} da completare`:"";
|
|||||||
document.querySelectorAll("select[id^=f-]").forEach(s=>sel[s.id]=s.value);
|
document.querySelectorAll("select[id^=f-]").forEach(s=>sel[s.id]=s.value);
|
||||||
// Table header.
|
// Table header.
|
||||||
let h="<thead><tr><th>recording<th>status<th>duration<th>speakers<th>MB<th>links<th>actions</tr></thead>";
|
let h="<thead><tr><th>recording<th>status<th>duration<th>speakers<th>MB<th>links<th>actions</tr></thead>";
|
||||||
// One tbody per recording; "running" when the status is done but the process is still alive.
|
// Pagination: PS meetings per page; clamp the page if recordings were removed, then draw the pager.
|
||||||
for(const r of j.recs){const st=r.running&&r.status=="done"?"running":r.status;
|
const np=Math.max(1,Math.ceil(j.recs.length/PS));if(pg_>=np)pg_=np-1;
|
||||||
|
pgr.innerHTML=np>1?`<button ${pg_?"":"disabled"} onclick="goPg(-1)">‹</button><span>pagina ${pg_+1} di ${np} (${j.recs.length} riunioni)</span><button ${pg_<np-1?"":"disabled"} onclick="goPg(1)">›</button>`:"";
|
||||||
|
// One tbody per recording on the current page; "running" when the status is done but the process is still alive.
|
||||||
|
for(const r of j.recs.slice(pg_*PS,(pg_+1)*PS)){const st=r.running&&r.status=="done"?"running":r.status;
|
||||||
// Display title, falling back to the upload name.
|
// Display title, falling back to the upload name.
|
||||||
const nm=r.title||r.upload;
|
const nm=r.title||r.upload;
|
||||||
// Main row: checkbox, title and rename buttons; status badge with error text and time since last data.
|
// Main row: checkbox, title and rename buttons; status badge with error text and time since last data.
|
||||||
|
|||||||
Reference in New Issue
Block a user