feat(archivar): 200-Wort-Raumbeschreibungen für FAISS Phase-1

room-map.json v3:
- Neues 'description'-Feld (~200 Wörter) für alle 4 Nicht-Catch-All-Räume
- BAT-Team: Trading-Plattform, Docker, Next.js, Prisma, Wyckoff
- Rocketchat-Plugin: DDP/WebSocket, Archivar, Gateway, Buttons
- LAN-Dokumentation: Homelab, Proxmox, Subnetze, VLAN, pfSense
- Protonbridge-Plugin: IMAP/SMTP-Proxy, Himalaya, Bridge

room_map.py:
- RoomEntry.description als optionales Feld (default '')
- _from_dict, save, add_or_update_room, Legacy-Migration aktualisiert

room_index.py:
- _room_to_text(): description prioritär, theme als Fallback
- Keywords weiterhin doppelt gewichtet im Embedding-Text

room-map.schema.json:
- description als optional string (minLength 50)
- version minimum auf 3

FAISS-Neubau via is_stale() nach Version-Bump automatisch
This commit is contained in:
Bernd (Hermes)
2026-06-18 06:31:11 +02:00
parent 8d6deb7f2d
commit 60665c5fd4
3 changed files with 26 additions and 5 deletions
+6 -1
View File
@@ -9,7 +9,7 @@
"version": {
"type": "integer",
"description": "Schema version for future migrations.",
"minimum": 2
"minimum": 3
},
"rooms": {
"type": "object",
@@ -28,6 +28,11 @@
"description": "Theme / purpose of the room.",
"minLength": 1
},
"description": {
"type": "string",
"description": "Detailed ~200-word description of the room's purpose, topics, artifacts, and typical tasks.",
"minLength": 50
},
"keywords_100": {
"type": "array",
"description": "Keywords for exact-match routing (high-confidence, low false-positive).",
+6 -2
View File
@@ -559,15 +559,19 @@ class RoomIndexManager:
@staticmethod
def _room_to_text(entry: RoomEntry) -> str:
"""Bildet einen Embedding-Text aus Theme + allen Keywords.
"""Bildet einen Embedding-Text aus Description + Keywords oder Theme + Keywords.
Der kombinierte Text wird von der Embedding-API vektorisiert.
Wenn eine Description vorhanden ist, wird diese mit höherer Priorität verwendet.
Keywords werden mit höherem Gewicht dupliziert, damit sie im
Embedding-Raum stärker repräsentiert sind.
"""
parts: List[str] = []
if entry.theme:
# Verwende Description wenn vorhanden, sonst Theme
if entry.description:
parts.append(entry.description)
elif entry.theme:
parts.append(entry.theme)
# Keywords doppelt für stärkere Gewichtung im Embedding
+13 -1
View File
@@ -59,6 +59,9 @@ class RoomEntry:
theme: str
"""Thema des Raums (ein Satz)."""
description: str = ""
"""Detaillierte Beschreibung des Raums (ca. 200 Wörter)."""
keywords_100: list[str] = field(default_factory=list)
"""100% Evidenz Stichworte für Keyword-Matching."""
@@ -350,13 +353,14 @@ class RoomMap:
return cls._from_dict(data)
def add_or_update_room(self, room_id: str, name: str, theme: str = "", keywords_100: Optional[list] = None, keywords_context: Optional[list] = None, catch_all: bool = False) -> None:
def add_or_update_room(self, room_id: str, name: str, theme: str = "", description: str = "", keywords_100: Optional[list] = None, keywords_context: Optional[list] = None, catch_all: bool = False) -> None:
"""Fügt Raum zur In-Memory-Map hinzu ODER aktualisiert bestehenden.
Args:
room_id: Rocket.Chat Raum-ID
name: Menschenlesbarer Name (z.B. "#Rocketchat-Plugin")
theme: Thema des Raums (ein Satz)
description: Detaillierte Beschreibung des Raums (ca. 200 Wörter)
keywords_100: 100% Evidenz Stichworte für Keyword-Matching
keywords_context: Kontextabhängige Stichworte für Keyword-Matching
catch_all: True wenn dieser Raum der EINE Catch-All-Raum ist
@@ -371,6 +375,7 @@ class RoomMap:
room_id=room_id,
name=name,
theme=theme,
description=description,
keywords_100=keywords_100,
keywords_context=keywords_context,
catch_all=catch_all
@@ -443,6 +448,7 @@ class RoomMap:
data["rooms"][room_id] = {
"name": room_entry.name,
"theme": room_entry.theme,
"description": room_entry.description,
"keywords_100": room_entry.keywords_100,
"keywords_context": room_entry.keywords_context,
"catch_all": room_entry.catch_all
@@ -487,6 +493,7 @@ class RoomMap:
room_id=room_id,
name=room_data.get("name", room_id),
theme=room_data.get("theme", ""),
description=room_data.get("description", ""),
keywords_100=keywords_100,
keywords_context=keywords_context,
catch_all=room_data.get("catch_all", False),
@@ -541,6 +548,7 @@ def _migrate_from_env_vars() -> Optional[dict]:
rooms[catchall] = {
"name": "Catch-All (legacy)",
"theme": "Legacy catch-all from ARCHIVAR_CATCHALL_ROOM",
"description": "Legacy catch-all room for all topics without their own room.",
"keywords": [],
"catch_all": True,
}
@@ -550,6 +558,7 @@ def _migrate_from_env_vars() -> Optional[dict]:
rooms[alarm] = {
"name": "ALARM Room (legacy)",
"theme": "Legacy alarm room from ARCHIVAR_ALARM_ROOM",
"description": "Legacy alarm room for critical alerts and urgent notifications.",
"keywords": ["alarm", "dringend", "sofort", "kritisch", "ausfall"],
"catch_all": False,
}
@@ -559,6 +568,7 @@ def _migrate_from_env_vars() -> Optional[dict]:
rooms[fakt] = {
"name": "FAKT Room (legacy)",
"theme": "Legacy fakt room from ARCHIVAR_FAKT_ROOM",
"description": "Legacy fakt room for documentation and factual information.",
"keywords": ["dokumentation", "fakt", "info"],
"catch_all": False,
}
@@ -568,6 +578,7 @@ def _migrate_from_env_vars() -> Optional[dict]:
rooms[frage] = {
"name": "FRAGE Room (legacy)",
"theme": "Legacy frage room from ARCHIVAR_FRAGE_ROOM",
"description": "Legacy question room for help requests and problem solving.",
"keywords": ["frage", "hilfe", "problem"],
"catch_all": False,
}
@@ -581,6 +592,7 @@ def _migrate_from_env_vars() -> Optional[dict]:
rooms[proj_room_id] = {
"name": f"Project: {proj_key} (legacy)",
"theme": f"Legacy project room for {proj_key}",
"description": f"Legacy project room for {proj_key} related discussions and tasks.",
"keywords": [proj_key],
"catch_all": False,
}