Drop-video button (blocks reruns), manual title, striped recording groups, collapse whisper loops, fix report _clean name clash
This commit is contained in:
+9
-5
@@ -38,13 +38,17 @@ def _tick(note):
|
||||
if PROG: PROG[1] += 1; db.tick(PROG[0], PROG[1], max(PROG[2], PROG[1] + 1) if note != "fine" else PROG[1], note)
|
||||
|
||||
|
||||
def _manual_title(name):
|
||||
p = db.out_dir(name) / "title.txt"
|
||||
return p.read_text(encoding="utf-8").strip() if p.exists() else ""
|
||||
|
||||
THINK = 1024 # reasoning budget per report call (server: --reasoning-budget); added to max_tokens so the answer keeps its room
|
||||
|
||||
def _clean(o):
|
||||
def _strip_junk(o):
|
||||
"""Small models sometimes append '<closing braces> + a self-check' inside the last string value: cut it."""
|
||||
if isinstance(o, str): return re.split(r"[\]}]{2,}|[\u2705\u2714\u274c]", o)[0].strip()
|
||||
if isinstance(o, list): return [_clean(x) for x in o]
|
||||
if isinstance(o, dict): return {k: _clean(v) for k, v in o.items()}
|
||||
if isinstance(o, list): return [_strip_junk(x) for x in o]
|
||||
if isinstance(o, dict): return {k: _strip_junk(v) for k, v in o.items()}
|
||||
return o
|
||||
|
||||
|
||||
@@ -63,7 +67,7 @@ def chat(system, user, max_tokens, retries=2, think=False):
|
||||
r = _open(urllib.request.Request(API, json.dumps(body).encode(), {"Content-Type": "application/json"}), timeout=1800)
|
||||
t = llama.content(json.load(r), f"report ({max_tokens} max)")
|
||||
t = re.sub(r"<think>.*?</think>", "", t, flags=re.S)
|
||||
d = _clean(json.loads(t[t.find("{"):t.rfind("}") + 1]))
|
||||
d = _strip_junk(json.loads(t[t.find("{"):t.rfind("}") + 1]))
|
||||
if isinstance(d, dict): return d
|
||||
except (ValueError, KeyError): pass
|
||||
return None
|
||||
@@ -330,7 +334,7 @@ def run(name, window_words=3000):
|
||||
if screen and (screen[-1]["title"] or "").lower() == (r["title"] or "").lower(): screen[-1]["t_end"] = r["t_end"]
|
||||
else: screen.append(r)
|
||||
m = re.match(r"(?:teams|meet)_(\d{4}-\d\d-\d\d)T(\d\d)-(\d\d)-\d\d", name)
|
||||
rep = {"name": name, "date": f"{m[1]} {m[2]}:{m[3]}" if m else "", "duration_s": dur, "meeting_title": title,
|
||||
rep = {"name": name, "date": f"{m[1]} {m[2]}:{m[3]}" if m else "", "duration_s": dur, "meeting_title": _manual_title(name) or title,
|
||||
"tldr": tldr, "attendees": list(att.values()), "attendees_source": attendees_source, "known_spelling": bool(known),
|
||||
"name_map": cmap, "shares": shares, "chat": chats, "references": references, "screen": screen, "topics": topics}
|
||||
(db.out_dir(name) / "report.json").write_text(json.dumps(rep, ensure_ascii=False, indent=1), encoding="utf-8")
|
||||
|
||||
Reference in New Issue
Block a user