refactor: complete command facade migration

This commit is contained in:
jxxghp
2026-08-24 00:00:37 +08:00
parent 9b0a96083f
commit e9a226af02
6 changed files with 33 additions and 18 deletions
+3 -3
View File
@@ -42,7 +42,7 @@ from app.agent.runtime_loader import (
get_running_agent_manager,
)
from app.chain.message import MessageChain
from app.command import Command
from app.application.commands import get_command, get_commands
from app.runtime.config import global_vars
from app.runtime.events import Event, EventManager
from app.api.principal import ApiPrincipal
@@ -1548,7 +1548,7 @@ def _build_web_agent_command_items() -> list[dict]:
:return: 按分类和命令名排序的命令列表
"""
commands = Command().get_commands() or {}
commands = get_commands() or {}
items = []
for command, data in commands.items():
if not command.startswith("/"):
@@ -1591,7 +1591,7 @@ def _get_web_agent_unknown_command_message(text: str) -> Optional[str]:
command = _extract_web_agent_slash_command(text)
if not command:
return None
if Command().get(command):
if get_command(command):
return None
return f"命令不存在:{command}"
+2 -2
View File
@@ -21,7 +21,7 @@ from app.application.site.query import SiteQueryService
from app.api.endpoints.plugin import register_plugin_api
from app.chain.site import SiteChain
from app.chain.torrents import TorrentsChain
from app.command import Command
from app.application.commands import init_commands
from app.application.plugin.runtime import get_plugin_manager as PluginManager
from app.adapters.web.security.access import verify_token
from app.api.principal import ApiPrincipal
@@ -569,7 +569,7 @@ def auth_site(
# 认证成功后,重新初始化插件
PluginManager().init_config()
Scheduler().init_plugin_jobs()
Command().init_commands()
init_commands()
register_plugin_api()
return _SchemaResponse(success=status, message=msg)