report: less repetition, cleaner shots, correct speakers

- docs/memory passes get the facts already reported, so topics stop repeating them
- regroup pass merges consecutive topics on the same subject
- shots: settle 1.5s after a scene change, yuvj444p, no duplicate screen per topic,
  click-to-zoom in report.html, OCR identifier misreads fixed by majority vote
- speakers: split diarized paragraphs where Teams captions change speaker
- talk time from those paragraphs, counting only detected speech
This commit is contained in:
Stefano Zini
2026-11-10 14:23:59 +01:00
parent b80207a186
commit 3f020cd246
5 changed files with 408 additions and 79 deletions
+14 -2
View File
@@ -25,7 +25,9 @@ _open = urllib.request.build_opener(urllib.request.ProxyHandler({})).open
# Italian prompt: link current-meeting topics to earlier excerpts; JSON output.
SYS_M = (
'Hai un argomento della riunione attuale ed estratti numerati di riunioni precedenti. Rispondi SOLO JSON: {"links":[{"text":str,"ref":int,"status":"confermato"|"cambiato"|"aperto"|"contesto"}]}. '
'"confermato": la riunione attuale conferma una decisione precedente; "cambiato": la contraddice o la modifica (riporta prima e dopo); "aperto": domanda aperta o azione precedente che la riunione attuale non ha chiuso; "contesto": informazione precedente pertinente non ripresa oggi. '
'"confermato": la riunione attuale conferma una decisione precedente; "cambiato": la contraddice o la modifica (riporta prima e dopo); "aperto": domanda aperta o azione precedente che questo argomento non chiude; "contesto": informazione precedente utile a capire l\'argomento. '
"Una sola voce per ciascun fatto precedente. Non ripetere, neanche riformulate, le voci in GIÀ COLLEGATI: sono già nel report sotto altri argomenti. "
'Non scrivere che qualcosa "non è stato ripreso oggi": vedi solo questo argomento, non tutta la riunione. '
'Massimo 4 voci, solo estratti davvero pertinenti allo stesso argomento, altrimenti lista vuota. In italiano, forma impersonale, senza etichette "Speaker N". Non inventare.'
)
# Prompt for ask(): answer from numbered excerpts only, cite as [n].
@@ -173,6 +175,7 @@ def _link(name):
# Clear old links so re-running the step does not accumulate them.
for topic in report_json["topics"]:
topic["previous"] = []
reported = [] # (text, source anchor) of links already given to earlier topics of this meeting
if rows:
# Query vectors: each current topic as title + content.
query_vectors = embed([_topic_text(topic) for topic in named_report["topics"]])
@@ -193,11 +196,12 @@ def _link(name):
" — ".join(str(action[key]) for key in ("who", "what", "when") if action.get(key))
for action in named_topic.get("actions", [])
)
# Prompt: current topic, then numbered earlier excerpts the model may cite as [n].
# Prompt: current topic, numbered earlier excerpts the model may cite as [n], then links already reported.
user = (
f"ARGOMENTO: {named_topic['title']}\nSINTESI: {' '.join(_summary_text(item) for item in named_topic.get('summary', []))}\nDECISIONI: {'; '.join(named_topic.get('decisions', []))}\n"
f"AZIONI: {actions}\nDOMANDE APERTE: {'; '.join(named_topic.get('open_questions', []))}\n\nPRECEDENTI:\n"
+ "\n".join(_prev_line(number, rows[index]) for number, index in enumerate(top, 1))
+ ("\n\nGIÀ COLLEGATI:\n" + "\n".join(f"- {text}" for text, _ in reported[-20:]) if reported else "")
)
# report.chat returns parsed JSON or None; None -> no links.
response = report.chat(SYS_M, user, 1500) or {}
@@ -210,6 +214,14 @@ def _link(name):
continue
if 1 <= ref <= len(top) and status in STATUSES and text:
previous = rows[top[ref - 1]]
source = f"{previous['name']}#{previous['anchor']}"
# Same earlier excerpt, same content (word overlap >= 0.45): a repeat the model let through.
if any(
seen_source == source and report._jaccard(text, seen_text) >= 0.45
for seen_text, seen_source in reported
):
continue
reported.append((text, source))
topic["previous"].append(
{
"text": text,