From 6825ba914999fef02776c7ab3e11493c67d16a86 Mon Sep 17 00:00:00 2001 From: "Bernd (Hermes)" Date: Thu, 23 Jul 2026 20:31:15 +0200 Subject: [PATCH] fix: Butler 2. Stufe Keywords als lesbarer Text + max 3 Buttons/Zeile --- plugin/adapter.py | 25 ++++++++++++++++++++++++- plugin/archivar/adapter_integration.py | 13 +++++++++++-- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/plugin/adapter.py b/plugin/adapter.py index 41b5ed2..2c335a7 100644 --- a/plugin/adapter.py +++ b/plugin/adapter.py @@ -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) diff --git a/plugin/archivar/adapter_integration.py b/plugin/archivar/adapter_integration.py index cd37daa..cc88f44 100644 --- a/plugin/archivar/adapter_integration.py +++ b/plugin/archivar/adapter_integration.py @@ -1223,14 +1223,23 @@ class ArchivarMessageHandler: strategie_topics = {"absprache", "planung", "strategie", "entscheidung"} return topic.lower().strip() in strategie_topics - def _get_nachklaerung_buttons(self) -> dict: + def _get_nachklaerung_buttons(self, keywords: Optional[list] = None) -> dict: """Gibt die Nachklärungs-Buttons für A2 zurück. + Args: + keywords: Optionale Liste von Keywords des Zielraums, + die als lesbarer Text in die Nachricht eingebaut werden. + Returns: Button-Template mit Strategie-Optionen. """ + text = "Ist es eines dieser Themen?" + if keywords: + kw_list = ", ".join(keywords) + text = f"Ist es eines dieser Themen?\nKeywords: {kw_list}" + return { - "text": "Ist es eines dieser Themen?", + "text": text, "actions": [ {"text": "🤝 Absprache", "type": "absprache"}, {"text": "📋 Planung", "type": "planung"},