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

View File

@@ -20,14 +20,14 @@ class QuerySubscribesTool(MoviePilotTool):
subscribes = subscribe_oper.list()
filtered_subscribes = []
for sub in subscribes:
if status != "all" and sub.status != status:
if status != "all" and sub.state != status:
continue
if media_type != "all" and sub.type != media_type:
continue
filtered_subscribes.append(sub)
if filtered_subscribes:
return json.dumps([s.dict() for s in filtered_subscribes], ensure_ascii=False, indent=2)
return json.dumps([s.to_dict() for s in filtered_subscribes], 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)}"