mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 23:47:41 +08:00
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:
@@ -26,8 +26,8 @@ class QueryMediaLibraryTool(MoviePilotTool):
|
||||
continue
|
||||
filtered_medias.append(media)
|
||||
if filtered_medias:
|
||||
return json.dumps([m.dict() for m in filtered_medias], ensure_ascii=False, indent=2)
|
||||
return json.dumps([m.to_dict() if hasattr(m, 'to_dict') else m.dict() if hasattr(m, 'dict') else m.model_dump() if hasattr(m, 'model_dump') else m for m in filtered_medias], ensure_ascii=False, indent=2)
|
||||
return "媒体库中未找到相关媒体。"
|
||||
except Exception as e:
|
||||
logger.error(f"查询媒体库失败: {e}")
|
||||
logger.error(f"查询媒体库失败: {e}", exc_info=True)
|
||||
return f"查询媒体库时发生错误: {str(e)}"
|
||||
|
||||
Reference in New Issue
Block a user