From 79436666e1e1e7cc9ff07a53023c3c7f06577d4c Mon Sep 17 00:00:00 2001 From: ponsde <2126824294@qq.com> Date: Wed, 4 Mar 2026 13:03:47 +0000 Subject: [PATCH 1/2] fix(bot): fix TelegramChannel.__init__ NameError from undefined kwargs TelegramChannel.__init__ references **kwargs in super().__init__() call, but kwargs is not in the method signature. This causes a NameError when the Telegram channel is instantiated, making it completely unusable. Also fixes the type hint from undefined TelegramConfig to the correct TelegramChannelConfig which is already imported. --- bot/vikingbot/channels/telegram.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot/vikingbot/channels/telegram.py b/bot/vikingbot/channels/telegram.py index 2e76a32d..e0c2f2e0 100644 --- a/bot/vikingbot/channels/telegram.py +++ b/bot/vikingbot/channels/telegram.py @@ -99,11 +99,11 @@ class TelegramChannel(BaseChannel): def __init__( self, - config: TelegramConfig, + config: TelegramChannelConfig, bus: MessageBus, groq_api_key: str = "", ): - super().__init__(config, bus, **kwargs) + super().__init__(config, bus) self.config: TelegramChannelConfig = config self.groq_api_key = groq_api_key self._app: Application | None = None From bfcb96528933f00e021e3587a013df476463443d Mon Sep 17 00:00:00 2001 From: ponsde <2126824294@qq.com> Date: Wed, 4 Mar 2026 13:03:54 +0000 Subject: [PATCH 2/2] fix(bot): skip empty content in assistant messages for Claude compatibility When the LLM responds with only tool_calls and no text, content is None. The expression `content or ""` produces an empty string, which Claude's API rejects with 400 Bad Request ("text content blocks must be non-empty"). Only include the content field when it is non-empty. --- bot/vikingbot/agent/context.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bot/vikingbot/agent/context.py b/bot/vikingbot/agent/context.py index 25570043..a989cdb5 100644 --- a/bot/vikingbot/agent/context.py +++ b/bot/vikingbot/agent/context.py @@ -303,7 +303,10 @@ def add_assistant_message( Returns: Updated message list. """ - msg: dict[str, Any] = {"role": "assistant", "content": content or ""} + msg: dict[str, Any] = {"role": "assistant"} + + if content: + msg["content"] = content if tool_calls: msg["tool_calls"] = tool_calls