01629780f4
Code du systeme de memoire multi-LLM sur Trilium : - trilium_api.py : wrapper trilium-py (notes, labels, relations) - mcp_server.py : serveur MCP Starlette (19 tools, OAuth + Bearer) - api_context.py : API REST FastAPI - trilium_context.py : workflow CLI - watchdog.sh, start_*.sh : supervision et demarrage - skills, docs et ontologie associes Secrets (.env, oauth_state.json) exclus via .gitignore.
31 lines
1.2 KiB
Python
31 lines
1.2 KiB
Python
"""Audit lecture seule : detecte TOUS les labels en doublon, quel que soit le nom."""
|
|
from trilium_api import search_by_label, get_note
|
|
|
|
types_notes = ["backlogItem", "decision", "historiqueItem", "conversation",
|
|
"termeGlossaire", "projet", "contexteReprise", "skill", "documentation"]
|
|
|
|
notes_traitees = set()
|
|
total_doublons = 0
|
|
notes_affectees = 0
|
|
|
|
for tn in types_notes:
|
|
for n in search_by_label("type", tn):
|
|
nid = n["noteId"]
|
|
if nid in notes_traitees:
|
|
continue
|
|
notes_traitees.add(nid)
|
|
note = get_note(nid)
|
|
attrs = [a for a in note.get("attributes", []) if a.get("type") == "label"]
|
|
par_nom = {}
|
|
for a in attrs:
|
|
par_nom.setdefault(a.get("name"), []).append(a)
|
|
doublons_note = {nom: len(lst) for nom, lst in par_nom.items() if len(lst) > 1}
|
|
if doublons_note:
|
|
notes_affectees += 1
|
|
titre = note.get("title", "?")[:40]
|
|
print(f"{nid} ({titre}) : {doublons_note}")
|
|
total_doublons += sum(v - 1 for v in doublons_note.values())
|
|
|
|
print(f"\n{notes_affectees} notes affectees, {total_doublons} labels en double au total.")
|
|
print("Noms de labels concernes a verifier si absents de la liste de nettoyage :")
|