From 9588d87d11bd8ce7132c222bbe33dae26de84b56 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Sun, 30 Nov 2025 23:34:53 +0800 Subject: [PATCH] fix: assistant message validation error when tool_call exists but content not exists --- astrbot/core/agent/message.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/astrbot/core/agent/message.py b/astrbot/core/agent/message.py index 374ec7dc..25c44136 100644 --- a/astrbot/core/agent/message.py +++ b/astrbot/core/agent/message.py @@ -148,20 +148,23 @@ class Message(BaseModel): content: str | list[ContentPart] """The content of the message.""" + tool_calls: list[ToolCall] | list[dict] | None = None + """The tool calls of the message.""" + + tool_call_id: str | None = None + """The ID of the tool call.""" + class AssistantMessageSegment(Message): """A message segment from the assistant.""" role: Literal["assistant"] = "assistant" - content: str | list[ContentPart] | None = None - tool_calls: list[ToolCall] | list[dict] | None = None class ToolCallMessageSegment(Message): """A message segment representing a tool call.""" role: Literal["tool"] = "tool" - tool_call_id: str class UserMessageSegment(Message):