feat: enhance MoviePilotTool with customizable tool messages

- Added `get_tool_message` method to `MoviePilotTool` and its subclasses for generating user-friendly execution messages based on parameters.
- Improved message formatting for various tools, including `AddDownloadTool`, `AddSubscribeTool`, `DeleteDownloadTool`, and others, to provide clearer feedback during operations.
- This enhancement allows for more personalized and informative messages, improving user experience during tool execution.
This commit is contained in:
jxxghp
2025-11-18 12:42:24 +08:00
parent 984f29005a
commit 9cb79a7827
28 changed files with 415 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
"""删除订阅工具"""
from typing import Type
from typing import Optional, Type
from pydantic import BaseModel, Field
@@ -23,6 +23,11 @@ class DeleteSubscribeTool(MoviePilotTool):
description: str = "Delete a media subscription by its ID. This will remove the subscription and stop automatic downloads for that media."
args_schema: Type[BaseModel] = DeleteSubscribeInput
def get_tool_message(self, **kwargs) -> Optional[str]:
"""根据删除参数生成友好的提示消息"""
subscribe_id = kwargs.get("subscribe_id")
return f"正在删除订阅 (ID: {subscribe_id})"
async def run(self, subscribe_id: int, **kwargs) -> str:
logger.info(f"执行工具: {self.name}, 参数: subscribe_id={subscribe_id}")