Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(handler): restore quick reply target context

cyh0cf2c6ac3e9a
diff --git a/core/handlers/message_handler.py b/core/handlers/message_handler.py
index 5f87722b5..2a2aa73f3 100644
--- a/core/handlers/message_handler.py
+++ b/core/handlers/message_handler.py
@@ -497,7 +497,7 @@ class MessageHandler(BaseHandler):
try:
quick_reply_echo = self._t("message.quickReplyNote", text=reply_text)
quick_reply_echo_id = await im_client.send_message(
- self._get_target_context(context),
+ self.controller.processing_indicator.target_context(context),
quick_reply_echo,
)
except Exception as err:
@@ -507,7 +507,7 @@ class MessageHandler(BaseHandler):
if quick_reply_echo_id and getattr(self.config, "ack_mode", "typing") == "reaction":
try:
await im_client.add_reaction(
- self._get_target_context(context),
+ self.controller.processing_indicator.target_context(context),
quick_reply_echo_id,
":eyes:",
)
diff --git a/core/processing_indicator.py b/core/processing_indicator.py
index a496690be..72981b65b 100644
--- a/core/processing_indicator.py
+++ b/core/processing_indicator.py
@@ -135,7 +135,9 @@ class ProcessingIndicatorService:
if self._mode_supported(capabilities, mode, context)
]
- def _get_target_context(self, context: MessageContext) -> MessageContext:
+ def target_context(self, context: MessageContext) -> MessageContext:
+ """Return the platform-appropriate context for immediate ACK-style replies."""
+
im_client = self._get_im_client(context)
capabilities = self._capabilities(context)
if capabilities.supports_threads and im_client.should_use_thread_for_reply() and context.thread_id:
@@ -182,7 +184,7 @@ class ProcessingIndicatorService:
return handle
async def _start_message_indicator(self, handle: ProcessingIndicatorHandle, agent_name: str) -> bool:
- ack_context = self._get_target_context(handle.context)
+ ack_context = self.target_context(handle.context)
try:
ack_message_id = await self._get_im_client(ack_context).send_message(
ack_context,
diff --git a/tests/test_message_handler_typing.py b/tests/test_message_handler_typing.py
index d6a95710e..e77b2c9a3 100644
--- a/tests/test_message_handler_typing.py
+++ b/tests/test_message_handler_typing.py
@@ -483,6 +483,8 @@ class MessageHandlerTypingTests(unittest.IsolatedAsyncioTestCase):
await handler.handle_callback_query(context, "quick_reply:继续")
self.assertEqual(controller.im_client.removed_keyboards, [("chat1", "lark", "om_123")])
+ self.assertEqual(controller.im_client.sent_messages, [("chat1", "Reply: 继续")])
+ self.assertEqual(controller.im_client.reactions, [("chat1", "msg-1", ":eyes:")])
handler.handle_user_message.assert_awaited_once()
forwarded_context, forwarded_text = handler.handle_user_message.await_args.args
self.assertEqual(forwarded_text, "继续")