refactor(agent): rename list_all_commands to list_slash_commands and skill to command-dispatch

This commit is contained in:
jxxghp
2026-04-07 00:00:10 +08:00
parent a8fb4a6d84
commit 9fefd807f9
4 changed files with 19 additions and 19 deletions

View File

@@ -51,7 +51,7 @@ from app.agent.tools.impl.browse_webpage import BrowseWebpageTool
from app.agent.tools.impl.query_installed_plugins import QueryInstalledPluginsTool
from app.agent.tools.impl.query_plugin_capabilities import QueryPluginCapabilitiesTool
from app.agent.tools.impl.run_slash_command import RunSlashCommandTool
from app.agent.tools.impl.list_all_commands import ListAllCommandsTool
from app.agent.tools.impl.list_slash_commands import ListSlashCommandsTool
from app.core.plugin import PluginManager
from app.log import logger
from .base import MoviePilotTool
@@ -127,7 +127,7 @@ class MoviePilotToolFactory:
QueryInstalledPluginsTool,
QueryPluginCapabilitiesTool,
RunSlashCommandTool,
ListAllCommandsTool,
ListSlashCommandsTool,
]
# 创建内置工具
for ToolClass in tool_definitions:

View File

@@ -1,4 +1,4 @@
"""查询所有可用命令工具(系统命令 + 插件命令)"""
"""查询所有可用斜杠命令工具(系统命令 + 插件命令)"""
import json
from typing import Optional, Type
@@ -10,8 +10,8 @@ from app.command import Command
from app.log import logger
class ListAllCommandsInput(BaseModel):
"""查询所有可用命令工具的输入参数模型"""
class ListSlashCommandsInput(BaseModel):
"""查询所有可用斜杠命令工具的输入参数模型"""
explanation: str = Field(
...,
@@ -19,17 +19,17 @@ class ListAllCommandsInput(BaseModel):
)
class ListAllCommandsTool(MoviePilotTool):
name: str = "list_all_commands"
class ListSlashCommandsTool(MoviePilotTool):
name: str = "list_slash_commands"
description: str = (
"List all available commands in the system, including system preset commands "
"List all available slash commands in the system, including system preset commands "
"(e.g. /cookiecloud, /sites, /subscribes, /downloading, /transfer, /restart, etc.) "
"and plugin-registered commands. "
"Use this tool to discover what commands are available before executing them with run_slash_command. "
"Use this tool to discover what slash commands are available before executing them with run_slash_command. "
"This is especially useful when the user describes an action in natural language and you need to "
"find the matching command to fulfill their request."
)
args_schema: Type[BaseModel] = ListAllCommandsInput
args_schema: Type[BaseModel] = ListSlashCommandsInput
require_admin: bool = True
def get_tool_message(self, **kwargs) -> Optional[str]:

View File

@@ -24,7 +24,7 @@ class RunSlashCommandInput(BaseModel):
description="The slash command to execute, e.g. '/cookiecloud'. "
"Must start with '/'. Can include arguments after the command, e.g. '/command arg1 arg2'. "
"Use query_plugin_capabilities tool to discover available plugin commands, "
"or list_all_commands tool to discover all available commands (including system commands).",
"or list_slash_commands tool to discover all available commands (including system commands).",
)
@@ -36,7 +36,7 @@ class RunSlashCommandTool(MoviePilotTool):
"1) System preset commands (e.g. /cookiecloud, /sites, /subscribes, /downloading, /transfer, /restart, etc.) "
"2) Plugin commands registered by installed plugins. "
"Use the query_plugin_capabilities tool to discover plugin commands, "
"or the list_all_commands tool to discover all available commands. "
"or the list_slash_commands tool to discover all available commands. "
"The command will be executed asynchronously. "
"Note: This tool triggers the command execution but the actual processing happens in the background."
)

View File

@@ -1,5 +1,5 @@
---
name: command-execute
name: command-dispatch
description: >-
Use this skill when the user's intent is to execute a system or plugin function. Applicable scenarios include:
1) The user sends a slash command starting with / (e.g. /cookiecloud, /sites, /subscribes, etc.);
@@ -7,12 +7,12 @@ description: >-
(e.g. "sync sites", "show subscriptions", "refresh subscriptions", "check downloads", etc.).
This skill helps you identify the user's intent, find the matching command, extract necessary parameters,
and execute the corresponding command.
allowed-tools: list_all_commands query_plugin_capabilities run_slash_command
allowed-tools: list_slash_commands query_plugin_capabilities run_slash_command
---
# Command Execute
# Command Dispatch
Use this skill to identify user intent and invoke the corresponding system or plugin command.
Use this skill to identify user intent and dispatch the corresponding system or plugin command.
## When to Use
@@ -29,7 +29,7 @@ Use this skill to identify user intent and invoke the corresponding system or pl
## Tools
- `list_all_commands` — List all available commands (system + plugin), returns command name, description, and category
- `list_slash_commands` — List all available slash commands (system + plugin), returns command name, description, and category
- `query_plugin_capabilities` — Query detailed plugin capabilities (commands, actions, scheduled services)
- `run_slash_command` — Execute a specified command (works for both system and plugin commands)
@@ -44,7 +44,7 @@ Determine whether the user's message is requesting the execution of a command:
### Step 2: Find Matching Command
Use `list_all_commands` to retrieve all available commands. Match the user's described intent against the `description` and `category` fields of each command.
Use `list_slash_commands` to retrieve all available commands. Match the user's described intent against the `description` and `category` fields of each command.
If the user's description involves a specific plugin's functionality, additionally use `query_plugin_capabilities` to query that plugin's detailed capabilities.
@@ -69,5 +69,5 @@ Command execution is asynchronous. After triggering, inform the user that the co
- Command execution requires admin privileges; the tool will automatically check permissions
- Both system and plugin commands are executed via the `run_slash_command` tool — no need to distinguish between them
- If you are unsure which command matches the user's intent, use `list_all_commands` first to look up before deciding
- If you are unsure which command matches the user's intent, use `list_slash_commands` first to look up before deciding
- Never guess non-existent commands; always select from the available command list