feat: 优化工具和SKILL.md

This commit is contained in:
PKC278
2026-03-18 14:27:07 +08:00
parent 226432ec7f
commit cedb0f565c
25 changed files with 457 additions and 424 deletions

View File

@@ -17,7 +17,7 @@ class SearchMediaInput(BaseModel):
title: str = Field(..., description="The title of the media to search for (e.g., 'The Matrix', 'Breaking Bad')")
year: Optional[str] = Field(None, description="Release year of the media (optional, helps narrow down results)")
media_type: Optional[str] = Field(None,
description="Type of media content: '电影' for films, '电视剧' for television series or anime series")
description="Allowed values: movie, tv")
season: Optional[int] = Field(None,
description="Season number for TV shows and anime (optional, only applicable for series)")
@@ -56,13 +56,22 @@ class SearchMediaTool(MoviePilotTool):
# 过滤结果
if results:
media_type_enum = None
if media_type:
media_type_key = media_type.strip().lower()
if media_type_key == "movie":
media_type_enum = MediaType.MOVIE
elif media_type_key == "tv":
media_type_enum = MediaType.TV
else:
return f"错误:无效的媒体类型 '{media_type}',支持的类型:'movie', 'tv'"
filtered_results = []
for result in results:
if year and result.year != year:
continue
if media_type:
if result.type != MediaType(media_type):
continue
if media_type_enum and result.type != media_type_enum:
continue
if season is not None and result.season != season:
continue
filtered_results.append(result)