diff --git a/plugin/archivar/room-map.schema.json b/plugin/archivar/room-map.schema.json index 005e8ed..0c2de59 100644 --- a/plugin/archivar/room-map.schema.json +++ b/plugin/archivar/room-map.schema.json @@ -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).", @@ -67,4 +72,4 @@ } }, "additionalProperties": false -} +} \ No newline at end of file diff --git a/plugin/archivar/room_index.py b/plugin/archivar/room_index.py index f54cc27..5304d42 100644 --- a/plugin/archivar/room_index.py +++ b/plugin/archivar/room_index.py @@ -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 diff --git a/plugin/archivar/room_map.py b/plugin/archivar/room_map.py index f2a8ddd..c089cbd 100644 --- a/plugin/archivar/room_map.py +++ b/plugin/archivar/room_map.py @@ -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, }