mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-03-19 19:46:55 +08:00
feat: 工具输入输出统一为movie或tv
This commit is contained in:
@@ -8,7 +8,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.chain.mediaserver import MediaServerChain
|
||||
from app.log import logger
|
||||
from app.schemas.types import MediaType
|
||||
from app.schemas.types import MediaType, media_type_to_agent
|
||||
|
||||
|
||||
class QueryLibraryExistsInput(BaseModel):
|
||||
@@ -49,12 +49,8 @@ class QueryLibraryExistsTool(MoviePilotTool):
|
||||
|
||||
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:
|
||||
media_type_enum = MediaType.from_agent(media_type)
|
||||
if not media_type_enum:
|
||||
return f"错误:无效的媒体类型 '{media_type}',支持的类型:'movie', 'tv'"
|
||||
|
||||
media_chain = MediaServerChain()
|
||||
@@ -109,7 +105,7 @@ class QueryLibraryExistsTool(MoviePilotTool):
|
||||
result_dict = {
|
||||
"title": mediainfo.title,
|
||||
"year": mediainfo.year,
|
||||
"type": existsinfo.type.value if existsinfo.type else None,
|
||||
"type": media_type_to_agent(existsinfo.type),
|
||||
"server": existsinfo.server,
|
||||
"server_type": existsinfo.server_type,
|
||||
"itemid": existsinfo.itemid,
|
||||
|
||||
Reference in New Issue
Block a user