From d32c6f946c5fd030ddfbbb645adb43b84a43d6ed Mon Sep 17 00:00:00 2001 From: Re-bin Date: Thu, 5 Mar 2026 15:17:30 +0000 Subject: [PATCH] fix(telegram): pin ptb>=22.6, fix double progress, clean up stale hatch config --- nanobot/agent/loop.py | 14 ++++++-------- nanobot/channels/telegram.py | 2 +- pyproject.toml | 5 +---- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/nanobot/agent/loop.py b/nanobot/agent/loop.py index 2f6a2bc..7f129a2 100644 --- a/nanobot/agent/loop.py +++ b/nanobot/agent/loop.py @@ -205,18 +205,16 @@ class AgentLoop: thoughts = [ self._strip_think(response.content), response.reasoning_content, - *(f"Thinking [{b.get('signature', '...')}]:\n{b.get('thought', '...')}" - for b in (response.thinking_blocks or []) if isinstance(b, dict) and "signature" in b) + *( + f"Thinking [{b.get('signature', '...')}]:\n{b.get('thought', '...')}" + for b in (response.thinking_blocks or []) + if isinstance(b, dict) and "signature" in b + ), ] - combined_thoughts = "\n\n".join(filter(None, thoughts)) - tool_hint_str = self._tool_hint(response.tool_calls) - if combined_thoughts: await on_progress(combined_thoughts) - await on_progress(f"{combined_thoughts}\n\n{tool_hint_str}", tool_hint=True) - else: - await on_progress(tool_hint_str, tool_hint=True) + await on_progress(self._tool_hint(response.tool_calls), tool_hint=True) tool_call_dicts = [ { diff --git a/nanobot/channels/telegram.py b/nanobot/channels/telegram.py index de95a15..884b2d0 100644 --- a/nanobot/channels/telegram.py +++ b/nanobot/channels/telegram.py @@ -292,7 +292,7 @@ class TelegramChannel(BaseChannel): reply_parameters=reply_params ) except Exception as e: - logger.warning("HTML parse failed (or draft send failed), falling back to plain text: {}", e) + logger.warning("HTML parse failed, falling back to plain text: {}", e) try: if is_progress and draft_id: await self._app.bot.send_message_draft( diff --git a/pyproject.toml b/pyproject.toml index 674a1ef..41d0fbb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ dependencies = [ "rich>=14.0.0,<15.0.0", "croniter>=6.0.0,<7.0.0", "dingtalk-stream>=0.24.0,<1.0.0", - "python-telegram-bot[socks]>=22.0,<23.0", + "python-telegram-bot[socks]>=22.6,<23.0", "lark-oapi>=1.5.0,<2.0.0", "socksio>=1.0.0,<2.0.0", "python-socketio>=5.16.0,<6.0.0", @@ -68,9 +68,6 @@ nanobot = "nanobot.cli.commands:app" requires = ["hatchling"] build-backend = "hatchling.build" -[tool.hatch.metadata] -allow-direct-references = true - [tool.hatch.build.targets.wheel] packages = ["nanobot"]