fix(adapter): button clicks bypass Archivar routing
Button responses (`is_button_response`) are ALWAYS direct replies to an agent question and carry a `question_id::choice` payload. Routing them through the Archivar risked landing a one-character "A" in the catch-all room where the agent would see it without the original question context. Now button clicks skip `classify_and_route()` entirely and stay in whatever room they originated from.
This commit is contained in:
@@ -597,9 +597,17 @@ class RocketChatAdapter(BasePlatformAdapter):
|
|||||||
category = ""
|
category = ""
|
||||||
decision = None
|
decision = None
|
||||||
try:
|
try:
|
||||||
|
# Button clicks and button responses are ALWAYS direct replies
|
||||||
|
# to an agent question — they carry a question_id::choice payload
|
||||||
|
# and must never be routed through the Archivar. Routing them
|
||||||
|
# risks landing a one-character "A" in the catch-all room where
|
||||||
|
# the agent sees it without the question context.
|
||||||
|
if not is_button_response:
|
||||||
decision = await self.archivar.handle_and_forward(text, origin_room_id=room_id, message_id=msg_id)
|
decision = await self.archivar.handle_and_forward(text, origin_room_id=room_id, message_id=msg_id)
|
||||||
if decision and decision.category:
|
if decision and decision.category:
|
||||||
category = decision.category
|
category = decision.category
|
||||||
|
else:
|
||||||
|
logger.debug("[rocketchat] Button response — Archivar bypassed for %s", text[:40])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug("[rocketchat] Archivar classification skipped: %s", e)
|
logger.debug("[rocketchat] Archivar classification skipped: %s", e)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user