Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion bot/vikingbot/agent/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions bot/vikingbot/channels/telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] workspace_path 未传递给 BaseChannel.__init__,导致 self.workspace_path 始终为 None,媒体文件会下载到 ~/.vikingbot/media 回退路径而非 workspace 目录。

这是预先存在的问题(原代码因 NameError 根本无法运行),但既然 TelegramChannel 现在可以正常工作了,建议一并修复:

  1. __init__ 中添加 workspace_path 参数:
def __init__(
    self,
    config: TelegramChannelConfig,
    bus: MessageBus,
    groq_api_key: str = "",
    workspace_path: Path | None = None,
):
    super().__init__(config, bus, workspace_path)
  1. manager.py 实例化时传递 workspace_path
channel = TelegramChannel(
    channel_config,
    self.bus,
    groq_api_key=additional_deps.get("groq_api_key"),
    workspace_path=workspace_path,
)

self.config: TelegramChannelConfig = config
self.groq_api_key = groq_api_key
self._app: Application | None = None
Expand Down
Loading