refactor: enhance tool message handling and improve error logging

- Updated _send_tool_message to accept a title parameter for better message context.
- Modified various tool implementations to utilize the new title parameter for clearer messaging.
- Improved error logging across multiple tools to include exception details for better debugging.
This commit is contained in:
jxxghp
2025-10-31 09:16:53 +08:00
parent c6baf43986
commit 055117d83d
9 changed files with 115 additions and 50 deletions
+3 -2
View File
@@ -26,12 +26,13 @@ class MoviePilotTool(BaseTool):
async def _arun(self, **kwargs) -> str:
raise NotImplementedError
def _send_tool_message(self, message: str, **kwargs):
def _send_tool_message(self, message: str, title: str = None, **kwargs):
"""发送工具执行消息"""
try:
self._message_helper.put(
message=message,
role="system"
role="system",
title=title or "工具执行"
)
except Exception as e:
logger.error(f"发送工具消息失败: {e}")