feat(archivar): zweistufige Keyword-Optimierung mit min_score=2

- find_room_by_keywords() mit min_score Parameter (default=2)
  Nur wenn best_score >= min_score → Raum returned, sonst None
  → Router fällt zu Embedding/LLM-Klassifikator durch
- verhindert Fehlrouting bei einzelnen Keyword-Treffern (plugin, etc.)

Architektur: Rainer | Implementierung: Miguel | QG: Rainer F1-F5 bestanden
This commit is contained in:
Hermes Agent
2026-06-09 21:13:27 +02:00
parent 2fe574cf71
commit b21a8bec19
+6 -2
View File
@@ -137,15 +137,17 @@ class RoomMap:
# ── Lookup Methods ────────────────────────────────────────────────
def find_room_by_keywords(self, text: str) -> Optional[RoomEntry]:
def find_room_by_keywords(self, text: str, min_score: int = 2) -> Optional[RoomEntry]:
"""Find the room with the most keyword matches for *text*.
Args:
text: The message text to classify.
min_score: Minimum score required to return a room (default: 2).
Returns:
The ``RoomEntry`` with the highest match score, or ``None``
if no room has any matching keywords.
if no room has any matching keywords or if the best score
is below the minimum threshold.
"""
best_room: Optional[RoomEntry] = None
best_score: int = 0
@@ -158,7 +160,9 @@ class RoomMap:
best_score = score
best_room = room
if best_room is not None and best_score >= min_score:
return best_room
return None
def is_excluded(self, room_id: str) -> bool:
"""True if *room_id* is in the excluded list (e.g. Multi-Agent-Raum)."""