Bug 6: Onboarding Catch-All-Auswahl zeigt jetzt DM als Option an

_finish_onboarding: DM-Raum aus _room_info wird immer in die
Catch-All-Auswahlliste aufgenommen (auch wenn nicht in room_map).
DM bekommt '(aktuell)'-Marker statt '(Catch-All)'.

_get_onboarding_room_list: Gleiche Logik — DM immer inkludiert,
mit echtem Namen statt 'Catch-All (legacy)'.

catch_all_change-Phase: DM-Auswahl ist no-op (bleibt Catch-All),
andere Raum-Auswahl setzt _set_catch_all() wie bisher.
This commit is contained in:
Bernd (Hermes)
2026-07-12 14:58:57 +02:00
parent d478d8079a
commit 13575aaf40
+47 -8
View File
@@ -1433,9 +1433,17 @@ class RocketChatAdapter(BasePlatformAdapter):
all_rooms = self._get_onboarding_room_list()
if 0 <= index < len(all_rooms):
rid, name = all_rooms[index]
self._set_catch_all(rid)
await self._post_message_with_retry(operator_room_id, f"🎯 {name} ist jetzt der Catch-All-Raum.")
logger.info("[rocketchat] Catch-All geändert zu: %s", name)
dm_room_id = state.get("operator_room_id", "")
# Bug 6: DM auswählen → kein Wechsel nötig (ist bereits Catch-All)
if rid == dm_room_id:
await self._post_message_with_retry(operator_room_id,
f"👍 {name} ist bereits der Catch-All-Raum — bleibt unverändert.")
logger.info("[rocketchat] Catch-All bleibt DM (kein Wechsel nötig)")
else:
self._set_catch_all(rid)
await self._post_message_with_retry(operator_room_id,
f"🎯 {name} ist jetzt der Catch-All-Raum.")
logger.info("[rocketchat] Catch-All geändert zu: %s", name)
else:
await self._post_message_with_retry(operator_room_id, f"❌ Ungültige Nummer. Bitte 1–{len(all_rooms)} wählen.")
return # onboarding_active bleibt True, warte auf korrekte Antwort
@@ -1726,19 +1734,37 @@ class RocketChatAdapter(BasePlatformAdapter):
else:
logger.warning("[rocketchat] B9: FAISS-Index-Rebuild fehlgeschlagen: %s", e)
# Baue nummerierte Raumliste
# Baue nummerierte Raumliste (inkl. Operator-DM als Catch-All-Option)
all_rooms = []
dm_room_id = operator_room_id
dm_room_name = self._room_info.get(dm_room_id, {}).get("name", "DM")
dm_already_in_map = dm_room_id in self.archivar._room_map.rooms
for rid, entry in self.archivar._room_map.rooms.items():
if rid in self.archivar._room_map._excluded_room_ids:
continue
all_rooms.append((rid, entry.name, entry.catch_all))
# Bug 6: DM-Raum mit echtem Namen anzeigen, nicht "Catch-All (legacy)"
if rid == dm_room_id:
all_rooms.append((rid, dm_room_name, True))
else:
all_rooms.append((rid, entry.name, entry.catch_all))
# Bug 6: DM-Raum immer als Option anbieten, auch wenn nicht in room_map
if not dm_already_in_map:
all_rooms.insert(0, (dm_room_id, dm_room_name, True))
all_rooms.sort(key=lambda x: (not x[2], x[1]))
lines = ["✅ Alle Räume zur Map hinzugefügt.",
"",
"**Aktuelle Raum-Übersicht:**"]
for i, (rid, name, is_catch) in enumerate(all_rooms, 1):
marker = " 🎯 (Catch-All)" if is_catch else ""
if rid == dm_room_id:
marker = " 🎯 (aktuell)"
elif is_catch:
marker = " 🎯 (Catch-All)"
else:
marker = ""
lines.append(f"{i}. {name}{marker}")
lines.append("")
lines.append("Möchtest du den Catch-All-Raum ändern? Antworte mit der Raumnummer, oder **überspringen** zum Behalten.")
@@ -1778,12 +1804,25 @@ class RocketChatAdapter(BasePlatformAdapter):
return keywords[:10]
def _get_onboarding_room_list(self) -> list:
"""Erstellt eine nummerierte Liste aller Räume (ohne excluded)."""
"""Erstellt eine nummerierte Liste aller Räume (ohne excluded), inkl. DM."""
rooms = []
dm_room_id = self._onboarding_state.get("operator_room_id", "")
dm_room_name = self._room_info.get(dm_room_id, {}).get("name", "DM")
dm_already_in_map = dm_room_id in self.archivar._room_map.rooms
for rid, entry in self.archivar._room_map.rooms.items():
if rid in self.archivar._room_map._excluded_room_ids:
continue
rooms.append((rid, entry.name))
# Bug 6: DM-Raum mit echtem Namen anzeigen
if rid == dm_room_id:
rooms.append((rid, dm_room_name))
else:
rooms.append((rid, entry.name))
# Bug 6: DM-Raum immer als Option anbieten, auch wenn nicht in room_map
if not dm_already_in_map:
rooms.insert(0, (dm_room_id, dm_room_name))
rooms.sort(key=lambda x: x[1]) # alphabetisch
return rooms