Allow ask during pipeline when text model is cloud
This commit is contained in:
+3
-2
@@ -135,6 +135,7 @@ def title(n):
|
||||
|
||||
|
||||
def busy(): return bool(QUEUE) or any(p.poll() is None for p in JOBS.values())
|
||||
def ask_blocked(): return busy() and llama.current(False) not in llama.REMOTE # cloud text model: no GPU contention, embed is CPU
|
||||
|
||||
def set_title(name, t):
|
||||
"""Manual meeting title (out/<name>/meta.json, wins over Teams/LLM titles); empty clears it. Patches report.json and re-renders."""
|
||||
@@ -309,7 +310,7 @@ def status():
|
||||
if d["running"] and not d["prog"]: d["boot"] = last_log(n)
|
||||
w = db.media(n)[0]; d["mb"] = round(w.stat().st_size / 1e6, 1) if w else 0
|
||||
rs.append(d)
|
||||
return {"now": t, "recs": rs, "busy": busy(), "queue": len(QUEUE), "skip_shots": (db.GLOBAL / "skip_shots.txt").exists(),
|
||||
return {"now": t, "recs": rs, "busy": busy(), "ask_blocked": ask_blocked(), "queue": len(QUEUE), "skip_shots": (db.GLOBAL / "skip_shots.txt").exists(),
|
||||
"llm": [llama.current(True), llama.current(False)], "omp": llama.omp_status(), "llms": [[[k, llama.label(k)] for k in llama.available(v)] for v in (True, False)]}
|
||||
|
||||
|
||||
@@ -397,7 +398,7 @@ class H(BaseHTTPRequestHandler):
|
||||
else: self._send(f.read_bytes(), ctype="application/pdf", headers=[("Content-Disposition", f'inline; filename="{name}.pdf"')])
|
||||
elif u.path == "/ask":
|
||||
if not q.get("q", "").strip(): return self._send("domanda vuota".encode(), 400)
|
||||
if busy(): return self._send("pipeline in corso: riprova dopo".encode(), 409)
|
||||
if ask_blocked(): return self._send("pipeline in corso: riprova dopo".encode(), 409)
|
||||
try: self._json(ask_once(q["q"]))
|
||||
except Exception as e: return self._send(f"errore: {e!r}".encode(), 503)
|
||||
else: self._send(b"not found", 404)
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ up.onchange=()=>{if(up.files[0])send(up.files[0]);up.value=""};
|
||||
addEventListener("dragover",e=>{e.preventDefault();document.body.classList.add("drag")});
|
||||
addEventListener("dragleave",e=>{if(!e.relatedTarget)document.body.classList.remove("drag")});
|
||||
addEventListener("drop",e=>{e.preventDefault();document.body.classList.remove("drag");const f=e.dataTransfer.files[0];if(f)send(f)});
|
||||
async function tick(){try{const j=await (await fetch("/status")).json();ab.disabled=j.busy;ab.title=j.busy?"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":"";
|
||||
const runp=j.recs.map(r=>r.prog).filter(p=>p&&p.pct!=null);document.title=runp.length?`${Math.round(runp[0].pct*100)}% · ${LBL[runp[0].step]} · Riunioni`:"Riunioni";
|
||||
for(const [s,i,p] of [[llm,0,"shots: "],[llmr,1,"report: "],[llma,1,""]])if(document.activeElement!==s){s.innerHTML=j.llms[i].map(([k,l])=>`<option value=${k}>${p}${E(l)}`).join("");s.value=j.llm[i];s.disabled=j.busy}
|
||||
skp.checked=j.skip_shots;skp.disabled=j.busy;
|
||||
|
||||
Reference in New Issue
Block a user