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)
|
||||
|
||||
Reference in New Issue
Block a user