mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 23:47:41 +08:00
Simplify message merging logic using list join
Co-authored-by: jxxghp <51039935+jxxghp@users.noreply.github.com>
This commit is contained in:
co-authored by
jxxghp
parent
271d1d23d5
commit
a081a69bbe
@@ -63,18 +63,15 @@ class MoviePilotTool(BaseTool, metaclass=ABCMeta):
|
|||||||
tool_message = explanation
|
tool_message = explanation
|
||||||
|
|
||||||
# 合并agent消息和工具执行消息,一起发送
|
# 合并agent消息和工具执行消息,一起发送
|
||||||
merged_message = ""
|
messages = []
|
||||||
if agent_message:
|
if agent_message:
|
||||||
merged_message = agent_message
|
messages.append(agent_message)
|
||||||
if tool_message:
|
if tool_message:
|
||||||
formatted_tool_message = f"⚙️ => {tool_message}"
|
messages.append(f"⚙️ => {tool_message}")
|
||||||
if merged_message:
|
|
||||||
merged_message = f"{merged_message}\n\n{formatted_tool_message}"
|
|
||||||
else:
|
|
||||||
merged_message = formatted_tool_message
|
|
||||||
|
|
||||||
# 发送合并后的消息
|
# 发送合并后的消息
|
||||||
if merged_message:
|
if messages:
|
||||||
|
merged_message = "\n\n".join(messages)
|
||||||
await self.send_tool_message(merged_message, title="MoviePilot助手")
|
await self.send_tool_message(merged_message, title="MoviePilot助手")
|
||||||
|
|
||||||
logger.debug(f'Executing tool {self.name} with args: {kwargs}')
|
logger.debug(f'Executing tool {self.name} with args: {kwargs}')
|
||||||
|
|||||||
Reference in New Issue
Block a user