mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-07 00:16:57 +08:00
feat: QuerySitesTool 增加返回 cookie 字段
This commit is contained in:
@@ -12,11 +12,18 @@ from app.log import logger
|
|||||||
|
|
||||||
class QuerySitesInput(BaseModel):
|
class QuerySitesInput(BaseModel):
|
||||||
"""查询站点工具的输入参数模型"""
|
"""查询站点工具的输入参数模型"""
|
||||||
explanation: str = Field(..., description="Clear explanation of why this tool is being used in the current context")
|
|
||||||
status: Optional[str] = Field("all",
|
explanation: str = Field(
|
||||||
description="Filter sites by status: 'active' for enabled sites, 'inactive' for disabled sites, 'all' for all sites")
|
...,
|
||||||
name: Optional[str] = Field(None,
|
description="Clear explanation of why this tool is being used in the current context",
|
||||||
description="Filter sites by name (partial match, optional)")
|
)
|
||||||
|
status: Optional[str] = Field(
|
||||||
|
"all",
|
||||||
|
description="Filter sites by status: 'active' for enabled sites, 'inactive' for disabled sites, 'all' for all sites",
|
||||||
|
)
|
||||||
|
name: Optional[str] = Field(
|
||||||
|
None, description="Filter sites by name (partial match, optional)"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class QuerySitesTool(MoviePilotTool):
|
class QuerySitesTool(MoviePilotTool):
|
||||||
@@ -40,7 +47,9 @@ class QuerySitesTool(MoviePilotTool):
|
|||||||
|
|
||||||
return " | ".join(parts) if len(parts) > 1 else parts[0]
|
return " | ".join(parts) if len(parts) > 1 else parts[0]
|
||||||
|
|
||||||
async def run(self, status: Optional[str] = "all", name: Optional[str] = None, **kwargs) -> str:
|
async def run(
|
||||||
|
self, status: Optional[str] = "all", name: Optional[str] = None, **kwargs
|
||||||
|
) -> str:
|
||||||
logger.info(f"执行工具: {self.name}, 参数: status={status}, name={name}")
|
logger.info(f"执行工具: {self.name}, 参数: status={status}, name={name}")
|
||||||
try:
|
try:
|
||||||
site_oper = SiteOper()
|
site_oper = SiteOper()
|
||||||
@@ -68,9 +77,10 @@ class QuerySitesTool(MoviePilotTool):
|
|||||||
"url": s.url,
|
"url": s.url,
|
||||||
"pri": s.pri,
|
"pri": s.pri,
|
||||||
"is_active": s.is_active,
|
"is_active": s.is_active,
|
||||||
|
"cookie": s.cookie,
|
||||||
"downloader": s.downloader,
|
"downloader": s.downloader,
|
||||||
"proxy": s.proxy,
|
"proxy": s.proxy,
|
||||||
"timeout": s.timeout
|
"timeout": s.timeout,
|
||||||
}
|
}
|
||||||
simplified_sites.append(simplified)
|
simplified_sites.append(simplified)
|
||||||
result_json = json.dumps(simplified_sites, ensure_ascii=False, indent=2)
|
result_json = json.dumps(simplified_sites, ensure_ascii=False, indent=2)
|
||||||
@@ -79,4 +89,3 @@ class QuerySitesTool(MoviePilotTool):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"查询站点失败: {e}", exc_info=True)
|
logger.error(f"查询站点失败: {e}", exc_info=True)
|
||||||
return f"查询站点时发生错误: {str(e)}"
|
return f"查询站点时发生错误: {str(e)}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user