[PRISM] Worker handles model_review tasks

This commit is contained in:
root committed 2026-11-23 23:15:10 +03:00
1 parent c215c0ecff
commit c28a8e7026
1 file changed
+3 -2
+3 -2
View File
@@ -46,7 +46,7 @@ while True:
break
task_id, kind, sid, mid = row
try:
if kind == "model_note":
if kind in ("model_note", "model_review"):
cur.execute("select vendor,name,role,domain from prism.models where id=%s", (mid,))
m = cur.fetchone()
if not m:
@@ -55,12 +55,13 @@ while True:
cur.execute("""select string_agg(key || '=' || coalesce(value_text,''), ', ' order by key)
from (select distinct key,value_text from prism.specs where model_id=%s limit 12) q""", (mid,))
specs = (cur.fetchone() or [""])[0] or ""
note_kind = "review" if kind == "model_review" else "positioning"
prompt = MODEL_PROMPT % (name, vendor, role or "unknown", domain or "unknown", specs[:800])
r = L.ask(prompt, max_tokens=250, temperature=0.2,
chain=[{"name": "qwen2.5:7b", "kind": "ollama", "timeout": 300}])
text = r["text"].strip()[:2000]
cur.execute("""insert into prism.model_notes(model_id,kind,text,model)
values (%s,'positioning',%s,'qwen2.5:7b')""", (mid, text))
values (%s,%s,%s,'qwen2.5:7b')""", (mid, note_kind, text))
cur.execute("""insert into prism.runs(model_id,kind,status,worker,model,stats,started_at,finished_at)
values (%s,'model_note7b','ok','229',%s,%s,now(),now())""",
(mid, "qwen2.5:7b", json.dumps({"task_id": task_id, "chars": len(text)})))