fix(snapshot): Cookie-Dedup + schneller Impressum-Tab + Tabellen-Zahl

- Cookies werden je Vendor nach Name dedupliziert (Consent-Phasen-Dubletten;
  BMW 2196 → ~772) — in cookie-check + get_snapshot, behebt aufgeblähte
  Kachel-/Finding-Zahlen.
- Impressum-Snapshot-Check überspringt den ~40s-LLM-Schritt (context skip_llm)
  → Tab lädt sofort statt leer zu bleiben.
- Vendor-Tabelle zeigt nur die Cookie-Zahl (kein 'Cookies'-Wort je Zeile).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-06-11 19:54:15 +02:00
parent b0ceae4350
commit 0f6cdc93fd
7 changed files with 51 additions and 4 deletions
@@ -35,6 +35,28 @@ STORAGE_LABELS = {
}
def dedupe_vendor_cookies(vendors: list[dict]) -> list[dict]:
"""Cookies tauchen je Vendor mehrfach auf (Consent-Phasen before_consent /
after_accept / after_reject derselben Crawl-Session). Dedupliziert je Vendor
nach (lower) Name — behält den ersten. Behebt aufgeblähte Cookie-/Finding-
Zahlen (BMW: 2196 → ~772 eindeutig)."""
out: list[dict] = []
for v in vendors or []:
seen: set[str] = set()
uniq: list[dict] = []
for c in (v.get("cookies") or []):
n = (c.get("name") or "").strip().lower()
if n and n in seen:
continue
if n:
seen.add(n)
uniq.append(c)
nv = dict(v)
nv["cookies"] = uniq
out.append(nv)
return out
def detect_storage_type(name: str, expiry: str = "") -> str:
"""Heuristik: echtes Cookie vs. anderer Endgeräte-Speicher.
@@ -259,7 +259,10 @@ class ImpressumAgent(BaseSpecialistAgent):
)
# ── Layer 3: Semantic-Validator nur für HIGH/MEDIUM-Fails ──
await self._semantic_demote(text, findings, coverage)
# In der interaktiven Snapshot-Ansicht (context skip_llm) übersprungen:
# der LLM-Schritt kostet ~40s, das deterministische Ergebnis genügt dort.
if not (agent_input.context or {}).get("skip_llm"):
await self._semantic_demote(text, findings, coverage)
# Confidence: harmonic mean der Findings (oder hoch wenn 0)
confs = [f.confidence for f in findings if f.confidence] or [0.95]