Skip to content

Your lightweight open-source personal agent.

merge: resolve PR #1966 conflicts with main

Xubin Ren44af7eca3f18
diff --cc nanobot/channels/feishu.py
index 3d83eaa5b,f4f0708b2..e3ab8a085
--- a/nanobot/channels/feishu.py
+++ b/nanobot/channels/feishu.py
@@@ -822,12 -914,29 +914,38 @@@ class FeishuChannel(BaseChannel)
receive_id_type = "chat_id" if msg.chat_id.startswith("oc_") else "open_id"
loop = asyncio.get_running_loop()
- # Handle tool hint messages as code blocks in interactive cards
++ # Handle tool hint messages as code blocks in interactive cards.
++ # These are progress-only messages and should bypass normal reply routing.
+ if msg.metadata.get("_tool_hint"):
+ if msg.content and msg.content.strip():
- await self._send_tool_hint_card(receive_id_type, msg.chat_id, msg.content.strip())
++ await self._send_tool_hint_card(
++ receive_id_type, msg.chat_id, msg.content.strip()
++ )
+ return
+
+ # Determine whether the first message should quote the user's message.
+ # Only the very first send (media or text) in this call uses reply; subsequent
+ # chunks/media fall back to plain create to avoid redundant quote bubbles.
+ reply_message_id: str | None = None
+ if (
+ self.config.reply_to_message
+ and not msg.metadata.get("_progress", False)
+ ):
+ reply_message_id = msg.metadata.get("message_id") or None
+
+ first_send = True # tracks whether the reply has already been used
+
+ def _do_send(m_type: str, content: str) -> None:
+ """Send via reply (first message) or create (subsequent)."""
+ nonlocal first_send
+ if reply_message_id and first_send:
+ first_send = False
+ ok = self._reply_message_sync(reply_message_id, m_type, content)
+ if ok:
+ return
+ # Fall back to regular send if reply fails
+ self._send_message_sync(receive_id_type, msg.chat_id, m_type, content)
+
for file_path in msg.media:
if not os.path.isfile(file_path):
logger.warning("Media file not found: {}", file_path)