fix: Butler 2. Stufe Keywords als lesbarer Text + max 3 Buttons/Zeile
This commit is contained in:
+24
-1
@@ -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)
|
||||
|
||||
@@ -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"},
|
||||
|
||||
Reference in New Issue
Block a user