scripts/edges_full_check.py aktualisiert
All checks were successful
Deploy mindnet to llm-node / deploy (push) Successful in 3s
All checks were successful
Deploy mindnet to llm-node / deploy (push) Successful in 3s
This commit is contained in:
parent
e4115e705e
commit
12c600edbe
|
|
@ -1,10 +1,12 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from collections import Counter
|
||||
from app.core.qdrant import QdrantConfig, get_client
|
||||
|
||||
|
||||
def fetch_all(client, col):
|
||||
points = []
|
||||
next_offset = None
|
||||
|
|
@ -17,6 +19,14 @@ def fetch_all(client, col):
|
|||
break
|
||||
return points
|
||||
|
||||
|
||||
def is_callout_rule(rule_id: str) -> bool:
|
||||
if not rule_id:
|
||||
return False
|
||||
r = rule_id.lower()
|
||||
return r.startswith("callout:edge:v1") or ("callout" in r)
|
||||
|
||||
|
||||
def main():
|
||||
cfg = QdrantConfig.from_env()
|
||||
cl = get_client(cfg)
|
||||
|
|
@ -35,7 +45,6 @@ def main():
|
|||
chunks_by_note = Counter([c.payload.get("note_id") for c in chunks])
|
||||
e_by_kind = Counter([e.payload.get("kind") or e.payload.get("relation") for e in edges])
|
||||
|
||||
# pro Note: belongs_to == #chunks; next == prev == max(chunks-1, 0)
|
||||
belongs_by_note = Counter()
|
||||
next_by_note = Counter()
|
||||
prev_by_note = Counter()
|
||||
|
|
@ -57,14 +66,10 @@ def main():
|
|||
b = belongs_by_note[nid]
|
||||
n = next_by_note[nid]
|
||||
p = prev_by_note[nid]
|
||||
per_note[nid] = {"chunks": ccount, "belongs_to": b, "next": n, "prev": p, "checks": {
|
||||
"belongs_to_equals_chunks": (b == ccount),
|
||||
"next_prev_match": (n == p == max(ccount-1, 0)),
|
||||
}}
|
||||
per_note[nid] = {"chunks": ccount, "belongs_to": b, "next": n, "prev": p, "checks": {"belongs_to_equals_chunks": (b == ccount), "next_prev_match": (n == p == max(ccount-1, 0))}}
|
||||
ok_belongs &= (b == ccount)
|
||||
ok_nextprev &= (n == p == max(ccount-1, 0))
|
||||
|
||||
# Rule-Statistiken & Dubletten-Prüfung
|
||||
explicit = defaults = callout = inline = 0
|
||||
multi_callout_detected = False
|
||||
callout_key_counts = Counter()
|
||||
|
|
@ -83,7 +88,7 @@ def main():
|
|||
else:
|
||||
seen.add(key)
|
||||
|
||||
if rule.startswith("callout:edge:v1"):
|
||||
if is_callout_rule(rule):
|
||||
callout += 1
|
||||
callout_key_counts[(cid, kind, rule)] += 1
|
||||
if rule.startswith("inline:rel:v1"):
|
||||
|
|
@ -116,5 +121,6 @@ def main():
|
|||
}
|
||||
print(json.dumps(report, ensure_ascii=False, indent=2))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user