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.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix: Fix Telegram MarkdownV2 escaping issues properly
cyhhaoe88bc381903a
diff --git a/modules/im/formatters/base_formatter.py b/modules/im/formatters/base_formatter.pyindex 40d9c8df3..c52ff5dd0 100644--- a/modules/im/formatters/base_formatter.py+++ b/modules/im/formatters/base_formatter.py@@ -112,6 +112,19 @@ class BaseMarkdownFormatter(ABC):formatted.append(f"• {item}")return formatted+ def format_definition_item(self, label: str, description: str) -> str:+ """Format a single definition item with label and description++ Args:+ label: The label/key text+ description: The description text++ Returns:+ Formatted definition item+ """+ # Default implementation - subclasses can override for platform-specific needs+ return f"• {self.format_bold(label)} - {self.format_text(description)}"+def format_definition_list(self, items: List[Tuple[str, str]], bold_key: bool = True) -> List[str]:"""Format a list of key-value pairs@@ -159,7 +172,8 @@ class BaseMarkdownFormatter(ABC):# Add itemsif items:for label, description in items:- lines.append(f"• {self.format_bold(label)} - {self.format_text(description)}")+ # Use a platform-specific separator method+ lines.append(self.format_definition_item(label, description))# Add footerif footer:diff --git a/modules/im/formatters/telegram_formatter.py b/modules/im/formatters/telegram_formatter.pyindex 6dd5506d2..974c42d1f 100644--- a/modules/im/formatters/telegram_formatter.py+++ b/modules/im/formatters/telegram_formatter.py@@ -11,18 +11,21 @@ class TelegramFormatter(BaseMarkdownFormatter):def format_bold(self, text: str) -> str:"""Format bold text using double asterisks"""- # Don't double-escape - text should be plain text- return f"*{text}*"+ # In MarkdownV2, text inside bold still needs escaping+ escaped_text = self.escape_special_chars(text)+ return f"*{escaped_text}*"def format_italic(self, text: str) -> str:"""Format italic text using underscores"""- # Don't double-escape - text should be plain text- return f"_{text}_"+ # In MarkdownV2, text inside italic still needs escaping+ escaped_text = self.escape_special_chars(text)+ return f"_{escaped_text}_"def format_strikethrough(self, text: str) -> str:"""Format strikethrough text using tildes"""- # Don't double-escape - text should be plain text- return f"~{text}~"+ # In MarkdownV2, text inside strikethrough still needs escaping+ escaped_text = self.escape_special_chars(text)+ return f"~{escaped_text}~"def format_link(self, text: str, url: str) -> str:"""Format hyperlink in Telegram style"""@@ -75,6 +78,16 @@ class TelegramFormatter(BaseMarkdownFormatter):return f"{emoji} {self.format_bold(title)}"return self.format_bold(title)+ def format_definition_item(self, label: str, description: str) -> str:+ """Format a definition item with proper escaping for MarkdownV2++ The dash separator needs to be escaped in Telegram MarkdownV2+ """+ bold_label = self.format_bold(label)+ escaped_separator = " \\- " # Escape the dash for MarkdownV2+ escaped_description = self.escape_special_chars(description)+ return f"• {bold_label}{escaped_separator}{escaped_description}"+def format_key_value(self, key: str, value: str, inline: bool = True) -> str:"""Format key-value pair"""# Key is bolded and escaped properly