fix(hilfe): vollständigen Hilfetext über zwei Teile ausgeben statt kürzen

Andreas' Entscheidung: lieber den vollständigen Hilfetext über zwei
Textblöcke ausgeben, als eine unvollständige Seite. Der progressive
Kürzungs-Fix (f74d206) schnitt Subcommand-Details weg (::keywords
review/status, ::butler mode-Optionen) — nicht akzeptabel.

- build_help_text() gibt wieder den vollständigen, ungekürzten Text zurück
- progressiven Kürzungs-Fix (Stufe 1-3) entfernt
- room_map_summary-Kürzungs-Fix (P1) beibehalten (optionale Sektion)
- NEU: build_help_text_parts() teilt bei > 4500 Zeichen in zwei Teile:
  Teil 1 = Core + Standard + RC-Befehle, Teil 2 = Natürliche Sprache +
  Status + Tipp
- adapter.py: _post_help_text() postet beide Teile nacheinander; alle
  Aufrufer (::hilfe, ::commands, natürliche Hilfe, unbekannter Befehl,
  Command-Question, Onboarding-Review) umgestellt
- Tests: test_build_help_text_full (alle Subcommands), test_build_help_text_split
  (zwei Teile < 4500), test_build_help_text_split_single_part_when_short
This commit is contained in:
Bernd (Hermes)
2026-08-26 20:22:35 +02:00
parent f74d206657
commit 89ca4d5e8c
3 changed files with 223 additions and 153 deletions
+29 -41
View File
@@ -2955,13 +2955,9 @@ class RocketChatAdapter(BasePlatformAdapter):
# Prüft VOR dem ::-Parsing und VOR dem Archivar-Routing, ob der
# Nutzer in natürlicher Sprache die Hilfeseite anfordert.
# "Ich brauche Hilfe", "Hilf mir", "help" etc. zeigen die ::hilfe-Seite.
from archivar.inline_commands import is_natural_help_request, build_help_text
from archivar.inline_commands import is_natural_help_request
if is_natural_help_request(routing_text):
help_text = build_help_text(
self._inline_commands,
room_map_summary=self._room_map_summary,
)
await self._post_message_with_retry(room_id, help_text)
await self._post_help_text(room_id)
routing_counter.increment('natural_help_triggered')
logger.info(
"ROUTING BYPASS: reason=natural_help_triggered, origin_room=%s, text=%s",
@@ -4971,7 +4967,6 @@ class RocketChatAdapter(BasePlatformAdapter):
from archivar.inline_commands import (
parse_inline_command,
is_natural_help_request,
build_help_text,
)
stripped = text.strip()
@@ -4990,15 +4985,12 @@ class RocketChatAdapter(BasePlatformAdapter):
return True
else:
# Unbekannter ::-Befehl → Hilfeseite zeigen
help_text = build_help_text(
self._inline_commands,
room_map_summary=self._room_map_summary,
)
unknown_msg = (
f"Unbekannter Befehl `::{command}`. "
f"Hier sind alle verfügbaren Befehle:\n\n{help_text}"
f"Hier sind alle verfügbaren Befehle:"
)
await self._post_message_with_retry(room_id, unknown_msg)
await self._post_help_text(room_id)
return True
# 2. UX-8: Command-Question? "Was macht ::curate?" etc.
@@ -5011,24 +5003,17 @@ class RocketChatAdapter(BasePlatformAdapter):
await self._post_message_with_retry(room_id, cmd_help)
else:
# Unbekannter Befehl → Liste aller verfügbaren
help_text = build_help_text(
self._inline_commands,
room_map_summary=self._room_map_summary,
)
unknown_msg = (
f"Unbekannter Befehl `::{cmd_question}`. "
f"Hier sind alle verfügbaren Befehle:\n\n{help_text}"
f"Hier sind alle verfügbaren Befehle:"
)
await self._post_message_with_retry(room_id, unknown_msg)
await self._post_help_text(room_id)
return True
# 3. Natürliche Hilfeseiten-Anfrage?
if is_natural_help_request(stripped):
help_text = build_help_text(
self._inline_commands,
room_map_summary=self._room_map_summary,
)
await self._post_message_with_retry(room_id, help_text)
await self._post_help_text(room_id)
return True
return False
@@ -5103,9 +5088,15 @@ class RocketChatAdapter(BasePlatformAdapter):
# (die Nachricht wurde schon gesendet)
return "" # Wird nicht gepostet, da _handle_inline_command den Return-Wert sendet
async def _cmd_hilfe(self, room_id: str, args: str) -> str:
"""::hilfe — Zeigt die Hilfeseite mit allen Befehlen."""
from archivar.inline_commands import build_help_text
async def _post_help_text(self, room_id: str) -> None:
"""Postet die vollständige Hilfeseite (ggf. in zwei Teilen).
Andreas' Entscheidung: lieber den vollständigen Hilfetext über zwei
Textblöcke ausgeben, als eine unvollständige Seite. Wenn der Text
> 4500 Zeichen ist, wird er in zwei Teile aufgeteilt und beide
nacheinander gepostet.
"""
from archivar.inline_commands import build_help_text_parts
# P1-4: PresenceEngine-Werte lesen (mit _has_presence-Guard)
presence_enabled = None
@@ -5115,12 +5106,21 @@ class RocketChatAdapter(BasePlatformAdapter):
presence_enabled = self._presence_engine.is_enabled()
current_status = getattr(self._presence_engine, '_last_sent_status', 'online') or 'online'
return build_help_text(
parts = build_help_text_parts(
self._inline_commands,
room_map_summary=self._room_map_summary,
presence_enabled=presence_enabled,
current_status=current_status,
)
for part in parts:
await self._post_message_with_retry(room_id, part)
async def _cmd_hilfe(self, room_id: str, args: str) -> str:
"""::hilfe — Zeigt die Hilfeseite mit allen Befehlen."""
await self._post_help_text(room_id)
# Wir haben bereits gepostet, also leeren String zurückgeben
# (die Nachricht wurde schon gesendet).
return ""
async def _cmd_status(self, room_id: str, args: str) -> str:
"""::status — Zeigt den aktuellen Plugin-Status."""
@@ -5252,11 +5252,8 @@ class RocketChatAdapter(BasePlatformAdapter):
async def _cmd_commands(self, room_id: str, args: str) -> str:
"""::commands — Listet alle verfügbaren ::-Befehle (::Variante von /commands)."""
from archivar.inline_commands import build_help_text
return build_help_text(
self._inline_commands,
room_map_summary=self._room_map_summary,
)
await self._post_help_text(room_id)
return ""
async def _cmd_restart(self, room_id: str, args: str) -> str:
"""::restart — Löst einen Gateway-Neustart aus (::Variante von /restart).
@@ -7480,16 +7477,7 @@ class RocketChatAdapter(BasePlatformAdapter):
if "Beibehalten" in choice or "⏭️" in choice or choice.lower() in ("beibehalten", "skip", "überspringen"):
await self._complete_onboarding(operator_room_id)
from archivar.inline_commands import build_help_text
presence_enabled = None
current_status = "online"
_has_presence = hasattr(self, '_presence_engine') and self._presence_engine is not None
if _has_presence:
presence_enabled = self._presence_engine.is_enabled()
current_status = getattr(self._presence_engine, '_last_sent_status', 'online') or 'online'
help_text = build_help_text(self._inline_commands, room_map_summary=self._room_map_summary,
presence_enabled=presence_enabled, current_status=current_status)
await self._post_message_with_retry(operator_room_id, help_text)
await self._post_help_text(operator_room_id)
logger.info("[rocketchat] F8 UX: Review-Flow abgeschlossen — ACTIVE")
return