feat: V7-5 + Fix C v7 — Pausen-Definition finalisiert + Butler-Mode Onboarding
V7-5: - W2: topic_hint-Update in extend_never_route (Inkonsistenz fix) - W3: LLM-Bypass wenn keine never_route Einträge für Raum (Performance) - W1: get_never_route_entry() Public-Methode (Encapsulation) Fix C v7: - room_map.py: butler_mode (cognitive/strict/off) in Schema, Default cognitive, abwärtskompatibel - router.py: _resolve_move_request wendet Butler-Mode an (off = Hard-Kill) - adapter.py: Onboarding-Frage nach Catch-All (🤖📋🔇 Buttons), Speicherung in room-map.json - 13 neue Tests: 9 RoomMap + 4 Router Archivar v7 vollständig: V7-1 bis V7-5 + Fix C v7
This commit is contained in:
+107
-2
@@ -1256,7 +1256,10 @@ class RocketChatAdapter(BasePlatformAdapter):
|
||||
is_operator_room = (operator_room and room_id == operator_room)
|
||||
is_onboarding = (
|
||||
(is_operator_room and stripped.startswith("ONBOARD:")) # v2 Button-Klick
|
||||
or (is_operator_room and stripped.startswith("BUTLER:")) # Fix C v7: Butler-Mode Button
|
||||
or (is_operator_room and self._onboarding_state.get("current_room_index", -1) >= 0) # v2 Interview läuft
|
||||
or (is_operator_room and self._onboarding_state.get("phase") == "butler_mode") # Fix C v7: Butler-Mode Phase
|
||||
or (is_operator_room and self._onboarding_state.get("phase") == "catch_all_change") # Catch-All Phase
|
||||
or (is_operator_room and "=" in stripped) # v1 Legacy: Name = Thema
|
||||
or (is_operator_room and stripped.startswith("#")) # v1 Legacy: #Name = Thema
|
||||
or (is_operator_room and stripped.lower().startswith("raum:")) # v1 Legacy: Raum: Name = Thema
|
||||
@@ -1985,7 +1988,109 @@ class RocketChatAdapter(BasePlatformAdapter):
|
||||
else:
|
||||
await self._post_message_with_retry(operator_room_id, "❌ Bitte eine Raumnummer (1, 2, …) oder 'überspringen' eingeben.")
|
||||
return # onboarding_active bleibt True
|
||||
# Catch-All-Frage beantwortet → Onboarding wirklich abschließen
|
||||
# Catch-All-Frage beantwortet → Butler-Mode-Frage stellen
|
||||
# Fix C v7: Nach Catch-All-Dialog folgt Butler-Mode-Frage
|
||||
self._onboarding_state = {
|
||||
"phase": "butler_mode",
|
||||
"operator_room_id": operator_room_id,
|
||||
}
|
||||
if self.archivar is not None:
|
||||
self.archivar._state.set_onboarding_state(self._onboarding_state)
|
||||
|
||||
# Butler-Mode-Frage senden
|
||||
_build = self._get_build_custom_buttons()
|
||||
butler_text = (
|
||||
"Möchtest du, dass ich bei themenfremden Nachrichten vorschlage "
|
||||
"den Raum zu wechseln (Butler-Prinzip)?\n\n"
|
||||
"🤖 **Kognitiv** — Ich erkenne selbstständig thematische Bezüge "
|
||||
"und frage natürlich nach. (Empfohlen für leistungsstarke Cloud-Modelle)\n"
|
||||
"📋 **Klassisch** — Ich folge festen Regeln: Bei sicheren Zuordnungen "
|
||||
"wechsle ich automatisch, bei unsicheren frage ich nach. "
|
||||
"(Empfohlen für lokale Modelle)\n"
|
||||
"🔇 **Aus** — Kein Butler, ich bleibe immer im Ursprungsraum."
|
||||
)
|
||||
butler_buttons = _build(
|
||||
["🤖 Kognitiv", "📋 Klassisch", "🔇 Aus"],
|
||||
prefix="BUTLER",
|
||||
style="primary",
|
||||
)
|
||||
butler_attachments = [{
|
||||
"color": "#1d74f5",
|
||||
"title": "Butler-Modus wählen",
|
||||
"actions": butler_buttons,
|
||||
}]
|
||||
await self._post_message_with_retry(
|
||||
operator_room_id, butler_text, attachments=butler_attachments
|
||||
)
|
||||
logger.info("[rocketchat] Fix C v7: Butler-Mode-Frage gesendet")
|
||||
return
|
||||
|
||||
# ── Phase: butler_mode (Fix C v7) ──────────────────────────────
|
||||
if state.get("phase") == "butler_mode":
|
||||
single_line = text.strip()
|
||||
if single_line.startswith("BUTLER::"):
|
||||
_, choice = single_line.split("::", 1)
|
||||
choice = choice.strip()
|
||||
if "Kognitiv" in choice or "🤖" in choice:
|
||||
mode = "cognitive"
|
||||
elif "Klassisch" in choice or "📋" in choice:
|
||||
mode = "strict"
|
||||
elif "Aus" in choice or "🔇" in choice:
|
||||
mode = "off"
|
||||
else:
|
||||
mode = "cognitive" # Default
|
||||
|
||||
# Speichere in room-map.json
|
||||
if self.archivar is not None:
|
||||
self.archivar._room_map.set_butler_mode(mode)
|
||||
from archivar.room_map import RoomMap
|
||||
from archivar.config import ROOM_MAP_PATH
|
||||
from pathlib import Path
|
||||
RoomMap.save(self.archivar._room_map, Path(ROOM_MAP_PATH))
|
||||
self.archivar._room_map.reload()
|
||||
|
||||
mode_labels = {
|
||||
"cognitive": "🤖 Kognitiv",
|
||||
"strict": "📋 Klassisch",
|
||||
"off": "🔇 Aus",
|
||||
}
|
||||
await self._post_message_with_retry(
|
||||
operator_room_id,
|
||||
f"👍 Butler-Modus: {mode_labels.get(mode, mode)}"
|
||||
)
|
||||
logger.info("[rocketchat] Fix C v7: Butler-Mode gesetzt auf '%s'", mode)
|
||||
else:
|
||||
# Text-Antwort (Fallback)
|
||||
t = single_line.lower()
|
||||
if "kognitiv" in t or "🤖" in t:
|
||||
mode = "cognitive"
|
||||
elif "klassisch" in t or "📋" in t:
|
||||
mode = "strict"
|
||||
elif "aus" in t or "🔇" in t:
|
||||
mode = "off"
|
||||
else:
|
||||
mode = "cognitive"
|
||||
|
||||
if self.archivar is not None:
|
||||
self.archivar._room_map.set_butler_mode(mode)
|
||||
from archivar.room_map import RoomMap
|
||||
from archivar.config import ROOM_MAP_PATH
|
||||
from pathlib import Path
|
||||
RoomMap.save(self.archivar._room_map, Path(ROOM_MAP_PATH))
|
||||
self.archivar._room_map.reload()
|
||||
|
||||
mode_labels = {
|
||||
"cognitive": "🤖 Kognitiv",
|
||||
"strict": "📋 Klassisch",
|
||||
"off": "🔇 Aus",
|
||||
}
|
||||
await self._post_message_with_retry(
|
||||
operator_room_id,
|
||||
f"👍 Butler-Modus: {mode_labels.get(mode, mode)}"
|
||||
)
|
||||
logger.info("[rocketchat] Fix C v7: Butler-Mode gesetzt auf '%s' (Text)", mode)
|
||||
|
||||
# Onboarding abschließen
|
||||
if self.archivar is not None:
|
||||
self.archivar._stats["onboarding_active"] = False
|
||||
self.archivar._state.clear_onboarding_state()
|
||||
@@ -1995,7 +2100,7 @@ class RocketChatAdapter(BasePlatformAdapter):
|
||||
if self._room_map_summary:
|
||||
logger.info("[rocketchat] FIX E: Raum-Map Summary nach Onboarding aktualisiert (%d Räume)",
|
||||
len(self._room_map_summary.splitlines()) - 1)
|
||||
logger.info("[rocketchat] Onboarding v2 vollständig abgeschlossen")
|
||||
logger.info("[rocketchat] Onboarding v2 vollständig abgeschlossen (mit Butler-Mode)")
|
||||
return
|
||||
|
||||
# ── Modus 1: Button-Klick (ONBOARD:<room_id>::<action>) ──────────
|
||||
|
||||
Reference in New Issue
Block a user