refactor: fusion glossaire vers concept (code API + MCP)
- api_context.py : ConceptCreate/Patch, routes /api/concepts, briefing 'Concepts' - mcp_server.py : get_concepts (ex get_glossaire), tool_get_note garde-fou lecture retire - redirige type=termeGlossaire vers type=concept partout (lecture, creation, briefing) - section briefing filtree sur concepts ayant une definition (role lexical) Corrige le 'glossaire vide' vu au test Phase 3 (code cherchait un type mort).
This commit is contained in:
+11
-12
@@ -86,8 +86,8 @@ TOOLS = [
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "get_glossaire",
|
||||
"description": "Liste les termes du glossaire d'un projet avec leur definition.",
|
||||
"name": "get_concepts",
|
||||
"description": "Liste les concepts d'un projet avec leur definition (l'ancien glossaire, fusionne dans concept).",
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"properties": {"projet": {"type": "string"}},
|
||||
@@ -305,9 +305,9 @@ def tool_get_historique(projet):
|
||||
if get_label_value(n["noteId"], "projet") == projet
|
||||
and get_label_value(n["noteId"], "encoreValide") == "true"]
|
||||
|
||||
def tool_get_glossaire(projet):
|
||||
notes = search_by_label("type", "termeGlossaire")
|
||||
return [{"id": n["noteId"], "terme": n.get("title", ""),
|
||||
def tool_get_concepts(projet):
|
||||
notes = search_by_label("type", "concept")
|
||||
return [{"id": n["noteId"], "titre": n.get("title", ""),
|
||||
"definition": get_label_value(n["noteId"], "definition") or ""} for n in notes
|
||||
if get_label_value(n["noteId"], "projet") == projet]
|
||||
|
||||
@@ -321,8 +321,9 @@ def tool_get_contexte(projet, llm_cible="LLM"):
|
||||
backlog = [n for n in search_by_label("type", "backlogItem")
|
||||
if get_label_value(n["noteId"], "projet") == projet
|
||||
and get_label_value(n["noteId"], "statut") not in ("fait", "abandonne")]
|
||||
glossaire = [n for n in search_by_label("type", "termeGlossaire")
|
||||
if get_label_value(n["noteId"], "projet") == projet]
|
||||
glossaire = [n for n in search_by_label("type", "concept")
|
||||
if get_label_value(n["noteId"], "projet") == projet
|
||||
and get_label_value(n["noteId"], "definition")]
|
||||
date = datetime.now().strftime("%d/%m/%Y")
|
||||
lines = [f"# REPRISE DE CONTEXTE — {projet} — {date}",
|
||||
f"**LLM cible : {llm_cible}**", ""]
|
||||
@@ -336,7 +337,7 @@ def tool_get_contexte(projet, llm_cible="LLM"):
|
||||
lines.append(f"- [{t}] {h.get('title','?')}")
|
||||
lines.append("")
|
||||
if glossaire:
|
||||
lines += ["## Glossaire"]
|
||||
lines += ["## Concepts"]
|
||||
for g in glossaire:
|
||||
d = get_label_value(g["noteId"], "definition") or "(voir note)"
|
||||
lines.append(f"- **{g.get('title','?')}** : {d}")
|
||||
@@ -449,13 +450,11 @@ def _type_systeme(note):
|
||||
return None
|
||||
|
||||
def tool_get_note(note_id):
|
||||
from trilium_api import TYPES_SYSTEME, get_note_content
|
||||
from trilium_api import get_note_content
|
||||
note = get_note(note_id)
|
||||
if not note:
|
||||
return {"error": "Note introuvable"}
|
||||
tv = _type_systeme(note)
|
||||
if tv not in TYPES_SYSTEME:
|
||||
return {"error": "Refus : note hors type systeme (type=%s)" % tv}
|
||||
return {"id": note_id, "titre": note.get("title", ""), "type": tv,
|
||||
"contenu": get_note_content(note_id)}
|
||||
|
||||
@@ -514,7 +513,7 @@ def tool_delete_note(note_id):
|
||||
|
||||
DISPATCH = {
|
||||
"get_backlog": tool_get_backlog, "get_decisions": tool_get_decisions,
|
||||
"get_historique": tool_get_historique, "get_glossaire": tool_get_glossaire,
|
||||
"get_historique": tool_get_historique, "get_concepts": tool_get_concepts,
|
||||
"get_contexte": tool_get_contexte, "add_decision": tool_add_decision,
|
||||
"add_history": tool_add_history, "add_backlog": tool_add_backlog,
|
||||
"delete_note": tool_delete_note,
|
||||
|
||||
Reference in New Issue
Block a user