fix(archivar): Blocklist gegen Raumnamen als gelernte Keywords + F5.3 Cap (P-112)
This commit is contained in:
+23
-4
@@ -273,6 +273,7 @@ if _MULTIROOM():
|
||||
from archivar.conversation_history import ConversationHistory
|
||||
from archivar.multiroom_context import MultiRoomContextRing
|
||||
from archivar.router import room_name_to_topic
|
||||
from archivar.blocklist import is_invalid_learn_keyword
|
||||
|
||||
# Routing-Counter: immer importieren (keine schweren Abhängigkeiten)
|
||||
from archivar.routing_counter import routing_counter
|
||||
@@ -3279,7 +3280,25 @@ class RocketChatAdapter(BasePlatformAdapter):
|
||||
learn_room_id = ctx.get("room_id", room_id)
|
||||
if choice == "1":
|
||||
# Button 1: 'Ja' → permanent (F5.1: sofort, keine 3-Confirmations)
|
||||
# P-112: Blocklist-Check — Raumnamen dürfen nicht als
|
||||
# thematisches Keyword gelernt werden (Raumtrennung kollabiert).
|
||||
block_reason = None
|
||||
if _MULTIROOM() and self.archivar is not None and keyword:
|
||||
block_reason = is_invalid_learn_keyword(
|
||||
keyword, getattr(self.archivar, "_room_map", None)
|
||||
)
|
||||
if block_reason:
|
||||
logger.warning(
|
||||
"[rocketchat] Stufe 5: LEARN 'Ja' REJECTED — "
|
||||
"keyword='%s' ist kein gültiges Lern-Keyword (%s)",
|
||||
keyword, block_reason,
|
||||
)
|
||||
await self._post_message_with_retry(
|
||||
room_id,
|
||||
"⚠️ Das kann ich nicht lernen — "
|
||||
f"„{keyword}“ ist ein Raumname, kein thematisches Keyword.",
|
||||
)
|
||||
elif _MULTIROOM() and self.archivar is not None and keyword:
|
||||
self.archivar._state.record_routing_decision(
|
||||
keyword=keyword,
|
||||
room_id=learn_room_id,
|
||||
@@ -3292,10 +3311,10 @@ class RocketChatAdapter(BasePlatformAdapter):
|
||||
"keyword='%s' room=%s decision=%s",
|
||||
keyword, learn_room_id[:8], decision,
|
||||
)
|
||||
await self._post_message_with_retry(
|
||||
room_id,
|
||||
"✅ Verstanden — ich merke mir das dauerhaft.",
|
||||
)
|
||||
await self._post_message_with_retry(
|
||||
room_id,
|
||||
"✅ Verstanden — ich merke mir das dauerhaft.",
|
||||
)
|
||||
elif choice == "2":
|
||||
# Button 2: 'Nur jetzt' → temporary (Themenring 24h)
|
||||
if _MULTIROOM() and self.archivar is not None and keyword:
|
||||
|
||||
Reference in New Issue
Block a user