Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
feat(): telegram support stream edit interval
stutiredboyaf6c75141f1e
diff --git a/nanobot/channels/telegram.py b/nanobot/channels/telegram.pyindex 0ba8ce8e9..2dde232b1 100644--- a/nanobot/channels/telegram.py+++ b/nanobot/channels/telegram.py@@ -166,6 +166,7 @@ def _markdown_to_telegram_html(text: str) -> str:_SEND_MAX_RETRIES = 3_SEND_RETRY_BASE_DELAY = 0.5 # seconds, doubled each retry+_STREAM_EDIT_INTERVAL_DEFAULT = 0.6 # min seconds between edit_message_text calls@dataclass@@ -190,6 +191,7 @@ class TelegramConfig(Base):connection_pool_size: int = 32pool_timeout: float = 5.0streaming: bool = True+ stream_edit_interval: float = Field(default=_STREAM_EDIT_INTERVAL_DEFAULT, ge=0.1)class TelegramChannel(BaseChannel):@@ -219,8 +221,6 @@ class TelegramChannel(BaseChannel):def default_config(cls) -> dict[str, Any]:return TelegramConfig().model_dump(by_alias=True)- _STREAM_EDIT_INTERVAL = 0.6 # min seconds between edit_message_text calls-def __init__(self, config: Any, bus: MessageBus):if isinstance(config, dict):config = TelegramConfig.model_validate(config)@@ -619,7 +619,7 @@ class TelegramChannel(BaseChannel):except Exception as e:logger.warning("Stream initial send failed: {}", e)raise # Let ChannelManager handle retry- elif (now - buf.last_edit) >= self._STREAM_EDIT_INTERVAL:+ elif (now - buf.last_edit) >= self.config.stream_edit_interval:try:await self._call_with_retry(self._app.bot.edit_message_text,