mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-05-11 18:10:15 +08:00
refactor: adjust default and maximum limits for plugin candidates and torrent results; enhance result formatting for agents
This commit is contained in:
@@ -8,6 +8,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.impl._plugin_tool_utils import (
|
||||
DEFAULT_PLUGIN_CANDIDATE_LIMIT,
|
||||
MAX_PLUGIN_CANDIDATE_LIMIT,
|
||||
list_installed_plugins,
|
||||
search_plugin_candidates,
|
||||
summarize_candidates,
|
||||
@@ -29,7 +30,7 @@ class QueryInstalledPluginsInput(BaseModel):
|
||||
)
|
||||
max_results: Optional[int] = Field(
|
||||
DEFAULT_PLUGIN_CANDIDATE_LIMIT,
|
||||
description="Maximum number of plugins to return. Defaults to 10.",
|
||||
description="Maximum number of plugins to return. Defaults to 50, capped at 200.",
|
||||
)
|
||||
|
||||
|
||||
@@ -53,7 +54,10 @@ class QueryInstalledPluginsTool(MoviePilotTool):
|
||||
def _clamp_results(max_results: Optional[int]) -> int:
|
||||
if max_results is None:
|
||||
return DEFAULT_PLUGIN_CANDIDATE_LIMIT
|
||||
return max(1, min(int(max_results), 200))
|
||||
try:
|
||||
return max(1, min(int(max_results), MAX_PLUGIN_CANDIDATE_LIMIT))
|
||||
except (TypeError, ValueError):
|
||||
return DEFAULT_PLUGIN_CANDIDATE_LIMIT
|
||||
|
||||
async def run(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user