fix: Butler 2. Stufe Keywords als lesbarer Text + max 3 Buttons/Zeile

This commit is contained in:
Bernd (Hermes)
2026-07-23 20:31:15 +02:00
parent 6b16381818
commit 6825ba9149
2 changed files with 35 additions and 3 deletions
+24 -1
View File
@@ -2027,7 +2027,16 @@ class RocketChatAdapter(BasePlatformAdapter):
# V8.2.1 A2: Nachklärung bei stay_once — Strategie-Buttons senden
if _MULTIROOM() and self.archivar is not None:
if self.archivar._should_trigger_nachklaerung("stay_once"):
nachklaerung_buttons = self.archivar._get_nachklaerung_buttons()
# Keywords des Zielraums als lesbaren Text einbauen
target_room_id = move_req.get("target_room", "")
target_keywords = []
if target_room_id and self.archivar._room_map is not None:
target_entry = self.archivar._room_map.rooms.get(target_room_id)
if target_entry:
target_keywords = target_entry.keywords_100[:5]
nachklaerung_buttons = self.archivar._get_nachklaerung_buttons(
keywords=target_keywords if target_keywords else None
)
await self._send_archivar_buttons(
room_id,
nachklaerung_buttons["text"],
@@ -4105,6 +4114,20 @@ class RocketChatAdapter(BasePlatformAdapter):
"actions": buttons,
}]
# Split buttons into groups of max 3 per attachment (UX: mobile readability)
MAX_BUTTONS_PER_ROW = 3
if len(buttons) > MAX_BUTTONS_PER_ROW:
attachments = []
for i in range(0, len(buttons), MAX_BUTTONS_PER_ROW):
chunk = buttons[i:i + MAX_BUTTONS_PER_ROW]
attachments.append({
"color": "#1d74f5",
"actions": chunk,
})
# First attachment gets the title
if attachments:
attachments[0]["title"] = text
success = await self._post_message_with_retry(room_id, text, attachments=attachments)
if success is not None:
# Mark room so the response stays here (no Archivar routing)