Compare commits
2 Commits
d478d8079a
...
3f1d688983
| Author | SHA1 | Date | |
|---|---|---|---|
| 3f1d688983 | |||
| 13575aaf40 |
+52
-7
@@ -1432,9 +1432,17 @@ class RocketChatAdapter(BasePlatformAdapter):
|
||||
index = int(single_line) - 1
|
||||
all_rooms = self._get_onboarding_room_list()
|
||||
if 0 <= index < len(all_rooms):
|
||||
rid, name = all_rooms[index]
|
||||
rid, name, _ = all_rooms[index]
|
||||
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.")
|
||||
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.")
|
||||
@@ -1726,19 +1734,38 @@ 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
|
||||
# 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))
|
||||
|
||||
# DM-Raum immer als Option anbieten, auch wenn nicht in room_map
|
||||
# (wird nachfolgend einsortiert)
|
||||
if not dm_already_in_map:
|
||||
all_rooms.append((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,13 +1805,31 @@ 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.
|
||||
|
||||
Returns list of (rid, name, is_current) tuples — gleiche Sortierung wie
|
||||
_finish_onboarding, damit Nummerierung in beiden Listen identisch ist.
|
||||
"""
|
||||
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))
|
||||
rooms.sort(key=lambda x: x[1]) # alphabetisch
|
||||
if rid == dm_room_id:
|
||||
rooms.append((rid, dm_room_name, True))
|
||||
else:
|
||||
rooms.append((rid, entry.name, entry.catch_all))
|
||||
|
||||
# DM-Raum immer als Option anbieten, auch wenn nicht in room_map
|
||||
# (wird nachfolgend einsortiert)
|
||||
if not dm_already_in_map:
|
||||
rooms.append((dm_room_id, dm_room_name, True))
|
||||
|
||||
# Gleiche Sortierung wie _finish_onboarding: Catch-All zuerst, dann alphabetisch
|
||||
rooms.sort(key=lambda x: (not x[2], x[1]))
|
||||
return rooms
|
||||
|
||||
def _set_catch_all(self, room_id: str) -> None:
|
||||
|
||||
Reference in New Issue
Block a user