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(feishu): preserve log markdown blocks

cyh19537289077c
diff --git a/core/message_dispatcher.py b/core/message_dispatcher.py
index 0e29ad982..dfbf55852 100644
--- a/core/message_dispatcher.py
+++ b/core/message_dispatcher.py
@@ -12,7 +12,7 @@ from pathlib import Path
from typing import Optional
from modules.im import MessageContext
-from core.reply_enhancer import process_reply
+from core.reply_enhancer import process_reply, strip_file_links
logger = logging.getLogger(__name__)
@@ -385,8 +385,7 @@ class ConsolidatedMessageDispatcher:
reply_enhancements_on = getattr(self.controller.config, "reply_enhancements", True)
if reply_enhancements_on:
- enhanced = process_reply(text)
- chunk = enhanced.text.strip()
+ chunk = strip_file_links(text).strip()
else:
chunk = text.strip()
diff --git a/core/reply_enhancer.py b/core/reply_enhancer.py
index 7215af7e4..6b5ac3d6c 100644
--- a/core/reply_enhancer.py
+++ b/core/reply_enhancer.py
@@ -93,6 +93,14 @@ def process_reply(text: str) -> EnhancedReply:
return EnhancedReply(text=text_clean.rstrip(), files=files, buttons=buttons)
+def strip_file_links(text: str) -> str:
+ """Remove ``file://`` markdown URLs while preserving the surrounding text."""
+ files = _extract_file_links(text)
+ if not files:
+ return text
+ return _strip_file_links(text)
+
+
# ---------------------------------------------------------------------------
# Internal helpers
# ---------------------------------------------------------------------------
diff --git a/tests/test_reply_enhancer_platform.py b/tests/test_reply_enhancer_platform.py
index 4d983fb0d..7919a2ae9 100644
--- a/tests/test_reply_enhancer_platform.py
+++ b/tests/test_reply_enhancer_platform.py
@@ -237,6 +237,22 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
[("C1", "Preview ready\n\nscreen", "markdown")],
)
+ async def test_lark_log_message_preserves_button_like_markdown_blocks(self):
+ controller = _StubController("lark")
+ dispatcher = ConsolidatedMessageDispatcher(controller)
+ context = MessageContext(user_id="U1", channel_id="C1", platform="lark")
+
+ await dispatcher.emit_agent_message(
+ context,
+ "assistant",
+ "Runbook\n---\n[step one] | [step two]",
+ )
+
+ self.assertEqual(
+ controller.im_client.sent_messages,
+ [("C1", "Runbook\n---\n[step one] | [step two]", "markdown")],
+ )
+
async def test_telegram_quick_reply_buttons_use_vertical_layout(self):
controller = _StubController("telegram")
dispatcher = ConsolidatedMessageDispatcher(controller)