mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-06 07:56:52 +08:00
refactor: 收口 V3 分层架构与插件兼容边界
This commit is contained in:
@@ -19,7 +19,7 @@ from app.agent.tools.tags import ToolTag
|
||||
from app.chain import ChainBase
|
||||
from app.runtime.config import settings
|
||||
from app.application.messaging.agent import matches_channel_admin
|
||||
from app.runtime.extensions.service_registry import ServiceConfigHelper
|
||||
from app.runtime.extensions.service_config import ServiceConfigHelper
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.message import Message
|
||||
from app.schemas.types import NotificationChannel, MessageType
|
||||
|
||||
@@ -88,7 +88,7 @@ from app.agent.tools.impl.update_custom_identifiers import UpdateCustomIdentifie
|
||||
from app.agent.tools.impl.query_system_settings import QuerySystemSettingsTool
|
||||
from app.agent.tools.impl.update_system_settings import UpdateSystemSettingsTool
|
||||
from app.agent.llm.capability import AgentCapabilityManager
|
||||
from app.runtime.extensions.plugin_manager import PluginManager
|
||||
from app.application.plugin.runtime import get_plugin_manager
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.notification import ChannelCapabilityManager
|
||||
from app.schemas.types import NotificationChannel
|
||||
@@ -96,6 +96,18 @@ from .base import MoviePilotTool
|
||||
from .catalog import ToolCatalogError, ToolCatalogSnapshot
|
||||
|
||||
|
||||
def _get_plugin_agent_tools() -> list[dict]:
|
||||
"""读取当前插件工具投影,隔离 Agent 工具工厂与 Runtime 管理器。"""
|
||||
try:
|
||||
return get_plugin_manager().get_plugin_agent_tools()
|
||||
except RuntimeError as error:
|
||||
# 纯工具目录探针可以在启动组合根之前运行;此时只跳过可选插件工具,
|
||||
# 不隐式创建 PluginManager,避免冷导入重新引入 Runtime 定位器。
|
||||
if "尚未由启动组合根装配" not in str(error):
|
||||
raise
|
||||
return []
|
||||
|
||||
|
||||
class MoviePilotToolFactory:
|
||||
"""
|
||||
MoviePilot工具工厂
|
||||
@@ -288,7 +300,7 @@ class MoviePilotToolFactory:
|
||||
|
||||
# 加载插件提供的工具
|
||||
plugin_tools_count = 0
|
||||
plugin_tools_info = PluginManager().get_plugin_agent_tools()
|
||||
plugin_tools_info = _get_plugin_agent_tools()
|
||||
for plugin_info in plugin_tools_info:
|
||||
plugin_id = plugin_info.get("plugin_id")
|
||||
plugin_name = plugin_info.get("plugin_name")
|
||||
@@ -337,7 +349,18 @@ class MoviePilotToolFactory:
|
||||
@classmethod
|
||||
def create_catalog(cls, **tool_kwargs) -> ToolCatalogSnapshot:
|
||||
"""在插件目录稳定窗口内构造一份完整本地工具快照。"""
|
||||
plugin_manager = PluginManager()
|
||||
try:
|
||||
plugin_manager = get_plugin_manager()
|
||||
except RuntimeError as error:
|
||||
# 没有启动上下文时仍允许构造内置工具目录;插件工具会在正式启动
|
||||
# 后由组合根提供的 Runtime 中重新物化。
|
||||
if "尚未由启动组合根装配" not in str(error):
|
||||
raise
|
||||
return ToolCatalogSnapshot.from_tools(
|
||||
cls.create_tools(**tool_kwargs),
|
||||
plugin_revision=0,
|
||||
factory_revision=cls.catalog_factory_revision(),
|
||||
)
|
||||
for _attempt in range(cls.CATALOG_BUILD_MAX_ATTEMPTS):
|
||||
before_revision = plugin_manager.get_plugin_agent_tools_revision()
|
||||
tools = cls.create_tools(**tool_kwargs)
|
||||
|
||||
@@ -5,8 +5,8 @@ import re
|
||||
from typing import Any, Dict, Iterable, Optional
|
||||
|
||||
from app.runtime.events import eventmanager
|
||||
from app.db.oper.subscribe import SubscribeOper
|
||||
from app.db.oper.systemconfig import SystemConfigOper
|
||||
from app.application.agentdata import SubscribePort as SubscribeOper
|
||||
from app.application.configuration import get_configured_system_config as SystemConfigOper
|
||||
from app.application.rules import RuleHelper
|
||||
from app.application.rules import RuleParser
|
||||
from app.application.rules import BUILTIN_RULE_SET
|
||||
|
||||
@@ -5,9 +5,9 @@ import shutil
|
||||
from typing import Any, Optional
|
||||
|
||||
from app.runtime.config import settings
|
||||
from app.runtime.extensions.plugin_manager import PluginManager
|
||||
from app.application.plugin.runtime import get_plugin_manager
|
||||
from app.application.plugin.install import PluginInstallCommand
|
||||
from app.db.oper.systemconfig import SystemConfigOper
|
||||
from app.application.configuration import get_configured_system_config as SystemConfigOper
|
||||
from app.adapters.external.server import MoviePilotServerHelper
|
||||
from app.adapters.external.market import PluginHelper
|
||||
from app.adapters.system.plugin.package import PluginPackageManager
|
||||
@@ -26,7 +26,7 @@ def get_plugin_snapshot(plugin_id: str) -> Optional[dict[str, Any]]:
|
||||
"""
|
||||
获取已安装插件的基础信息快照。
|
||||
"""
|
||||
plugin_manager = PluginManager()
|
||||
plugin_manager = get_plugin_manager()
|
||||
for plugin in plugin_manager.get_local_plugins():
|
||||
if plugin.id == plugin_id:
|
||||
return {
|
||||
@@ -81,7 +81,7 @@ def refresh_plugin_registrations(plugin_id: str) -> None:
|
||||
|
||||
def reload_plugin_runtime(plugin_id: str) -> None:
|
||||
"""重载插件实例并重新注册其命令、定时任务和 API。"""
|
||||
PluginManager().reload_plugin(plugin_id)
|
||||
get_plugin_manager().reload_plugin(plugin_id)
|
||||
refresh_plugin_registrations(plugin_id)
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ async def enrich_installed_plugin_sources(
|
||||
if not missing_source_plugins:
|
||||
return installed_plugins
|
||||
|
||||
plugin_manager = PluginManager()
|
||||
plugin_manager = get_plugin_manager()
|
||||
local_repo_map = _map_plugins_by_id(plugin_manager.get_local_repo_plugins())
|
||||
for plugin in missing_source_plugins:
|
||||
source_plugin = local_repo_map.get(getattr(plugin, "id", None))
|
||||
@@ -184,7 +184,7 @@ async def load_market_plugins(force_refresh: bool = False) -> list[Any]:
|
||||
"""
|
||||
聚合插件市场与本地插件仓库中的候选插件。
|
||||
"""
|
||||
plugin_manager = PluginManager()
|
||||
plugin_manager = get_plugin_manager()
|
||||
online_plugins = await plugin_manager.async_get_online_plugins(force=force_refresh)
|
||||
local_repo_plugins = plugin_manager.get_local_repo_plugins()
|
||||
if not online_plugins and not local_repo_plugins:
|
||||
@@ -196,7 +196,7 @@ def list_installed_plugins() -> list[Any]:
|
||||
"""
|
||||
返回当前已安装插件列表。
|
||||
"""
|
||||
plugin_manager = PluginManager()
|
||||
plugin_manager = get_plugin_manager()
|
||||
return [plugin for plugin in plugin_manager.get_local_plugins() if plugin.installed]
|
||||
|
||||
|
||||
@@ -300,7 +300,7 @@ async def install_plugin_runtime(
|
||||
"""
|
||||
按现有插件接口的行为安装插件,并刷新运行态注册信息。
|
||||
"""
|
||||
plugin_manager = PluginManager()
|
||||
plugin_manager = get_plugin_manager()
|
||||
plugin_helper = PluginHelper()
|
||||
package_manager = PluginPackageManager(plugin_helper)
|
||||
|
||||
@@ -395,7 +395,7 @@ async def uninstall_plugin_runtime(plugin_id: str) -> dict[str, Any]:
|
||||
remove_plugin_api(plugin_id)
|
||||
remove_plugin_job(plugin_id)
|
||||
|
||||
plugin_manager = PluginManager()
|
||||
plugin_manager = get_plugin_manager()
|
||||
plugin_class = plugin_manager.plugins.get(plugin_id)
|
||||
was_clone = bool(getattr(plugin_class, "is_clone", False))
|
||||
clone_files_removed = False
|
||||
|
||||
@@ -15,7 +15,7 @@ from app.chain.search import SearchChain
|
||||
from app.runtime.config import settings
|
||||
from app.domain.context import Context
|
||||
from app.domain.metainfo import MetaInfo
|
||||
from app.db.oper.site import SiteOper
|
||||
from app.application.agentdata import SitePort as SiteOper
|
||||
from app.application.directory import DirectoryHelper, validate_download_save_path
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.file import FileURI
|
||||
|
||||
@@ -7,7 +7,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.chain.subscribe import SubscribeChain
|
||||
from app.db.oper.user import UserOper
|
||||
from app.application.agentdata import UserPort as UserOper
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import MUSIC_ENTITY_ALBUM, MediaSource, MediaType, NotificationChannel
|
||||
from app.domain.media import normalize_music_type
|
||||
|
||||
@@ -8,8 +8,8 @@ from pydantic import BaseModel, Field, model_validator
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.runtime.config import settings
|
||||
from app.db.oper.agentchat import AgentChatOper
|
||||
from app.db.oper.agenttask import AgentTaskOper
|
||||
from app.application.agentdata import AgentChatPort as AgentChatOper
|
||||
from app.application.agentdata import AgentTaskPort as AgentTaskOper
|
||||
from app.runtime.scheduling import TimerUtils
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ from pydantic import BaseModel, Field
|
||||
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.db.oper.agenttask import AgentTaskOper
|
||||
from app.application.agentdata import AgentTaskPort as AgentTaskOper
|
||||
|
||||
|
||||
class DeleteAgentTaskInput(BaseModel):
|
||||
|
||||
@@ -6,7 +6,7 @@ from pydantic import BaseModel, Field
|
||||
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.db.oper.downloadhistory import DownloadHistoryOper
|
||||
from app.application.agentdata import DownloadHistoryPort as DownloadHistoryOper
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.runtime.events import eventmanager
|
||||
from app.db.oper.subscribe import SubscribeOper
|
||||
from app.application.agentdata import SubscribePort as SubscribeOper
|
||||
from app.adapters.external.server import MoviePilotServerHelper
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import EventType
|
||||
|
||||
@@ -7,7 +7,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.chain.storage import StorageChain
|
||||
from app.db.oper.transferhistory import TransferHistoryOper
|
||||
from app.application.agentdata import TransferHistoryPort as TransferHistoryOper
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.workflow import FileItem
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.runtime.config import settings
|
||||
from app.db.oper.agenttask import AgentTaskOper
|
||||
from app.application.agentdata import AgentTaskPort as AgentTaskOper
|
||||
|
||||
|
||||
class QueryAgentTasksInput(BaseModel):
|
||||
|
||||
@@ -7,7 +7,7 @@ from pydantic import BaseModel
|
||||
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.db.oper.systemconfig import SystemConfigOper
|
||||
from app.application.configuration import get_configured_system_config as SystemConfigOper
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import SystemConfigKey
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.chain.download import DownloadChain
|
||||
from app.db.oper.downloadhistory import DownloadHistoryOper
|
||||
from app.application.agentdata import DownloadHistoryPort as DownloadHistoryOper
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.transfer import DownloaderTorrent
|
||||
from app.schemas.types import MUSIC_ENTITY_RECORDING, TorrentQueryStatus, media_type_to_agent
|
||||
|
||||
@@ -7,7 +7,7 @@ from pydantic import BaseModel
|
||||
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.db.oper.systemconfig import SystemConfigOper
|
||||
from app.application.configuration import get_configured_system_config as SystemConfigOper
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import SystemConfigKey
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.chain.mediaserver import MediaServerChain
|
||||
from app.runtime.extensions.service_registry import ServiceConfigHelper
|
||||
from app.runtime.extensions.service_config import ServiceConfigHelper
|
||||
from app.runtime.log import logger
|
||||
|
||||
PAGE_SIZE = 20
|
||||
|
||||
@@ -7,7 +7,7 @@ from pydantic import BaseModel, Field
|
||||
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.runtime.extensions.plugin_manager import PluginManager
|
||||
from app.application.plugin.runtime import get_plugin_manager
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ class QueryPluginCapabilitiesTool(MoviePilotTool):
|
||||
@staticmethod
|
||||
def _load_plugin_capabilities(plugin_id: Optional[str] = None) -> dict:
|
||||
"""读取运行中插件实例暴露的内存能力信息。"""
|
||||
plugin_manager = PluginManager()
|
||||
plugin_manager = get_plugin_manager()
|
||||
result = {}
|
||||
|
||||
commands = plugin_manager.get_plugin_commands(pid=plugin_id)
|
||||
|
||||
@@ -8,7 +8,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.agent.tools.impl._plugin_tool_utils import get_plugin_snapshot
|
||||
from app.runtime.extensions.plugin_manager import PluginManager
|
||||
from app.application.plugin.runtime import get_plugin_manager
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class QueryPluginConfigTool(MoviePilotTool):
|
||||
ensure_ascii=False,
|
||||
)
|
||||
|
||||
plugin_manager = PluginManager()
|
||||
plugin_manager = get_plugin_manager()
|
||||
saved_config = plugin_manager.get_plugin_config(plugin_id) or {}
|
||||
result = {
|
||||
"success": True,
|
||||
|
||||
@@ -12,7 +12,7 @@ from app.agent.tools.impl._plugin_tool_utils import (
|
||||
build_preview_payload,
|
||||
get_plugin_snapshot,
|
||||
)
|
||||
from app.db.oper.plugindata import PluginDataOper
|
||||
from app.application.agentdata import PluginDataPort as PluginDataOper
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ from pydantic import BaseModel, Field
|
||||
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.db.oper.site import SiteOper
|
||||
from app.application.agentdata import SitePort as SiteOper
|
||||
from app.runtime.log import logger
|
||||
|
||||
SITE_USERDATA_DETAIL_PREVIEW_LIMIT = 10
|
||||
|
||||
@@ -7,7 +7,7 @@ from pydantic import BaseModel, Field
|
||||
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.db.oper.site import SiteOper
|
||||
from app.application.agentdata import SitePort as SiteOper
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ from pydantic import BaseModel, Field
|
||||
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.db.oper.subscribehistory import SubscribeHistoryOper
|
||||
from app.application.agentdata import SubscribeHistoryPort as SubscribeHistoryOper
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import MUSIC_ENTITY_RECORDING, MediaType, media_type_to_agent
|
||||
from app.domain.media import normalize_music_type
|
||||
|
||||
@@ -7,7 +7,7 @@ from pydantic import BaseModel, Field
|
||||
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.db.oper.subscribe import SubscribeOper
|
||||
from app.application.agentdata import SubscribePort as SubscribeOper
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.subscribe import Subscribe as SubscribeSchema
|
||||
from app.schemas.types import (
|
||||
|
||||
@@ -16,7 +16,7 @@ from app.agent.tools.impl._system_setting_utils import (
|
||||
should_redact_setting,
|
||||
)
|
||||
from app.runtime.config import settings
|
||||
from app.db.oper.systemconfig import SystemConfigOper
|
||||
from app.application.configuration import get_configured_system_config as SystemConfigOper
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ from pydantic import BaseModel, Field
|
||||
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.db.oper.transferhistory import TransferHistoryOper
|
||||
from app.application.agentdata import TransferHistoryPort as TransferHistoryOper
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import media_type_to_agent
|
||||
from app.foundation.text import cut as jieba_cut
|
||||
|
||||
@@ -7,7 +7,7 @@ from pydantic import BaseModel, Field
|
||||
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.db.oper.workflow import WorkflowOper
|
||||
from app.application.agentdata import WorkflowPort as WorkflowOper
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from pydantic import BaseModel, Field
|
||||
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.db.oper.agenttask import AgentTaskOper
|
||||
from app.application.agentdata import AgentTaskPort as AgentTaskOper
|
||||
|
||||
|
||||
class RunAgentTaskInput(BaseModel):
|
||||
|
||||
@@ -7,7 +7,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.chain.workflow import WorkflowChain
|
||||
from app.db.oper.workflow import WorkflowOper
|
||||
from app.application.workflow import get_configured_workflow_query
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class RunWorkflowTool(MoviePilotTool):
|
||||
)
|
||||
|
||||
try:
|
||||
workflow = await WorkflowOper().async_get(workflow_id)
|
||||
workflow = await get_configured_workflow_query().get(workflow_id)
|
||||
|
||||
if not workflow:
|
||||
return f"未找到工作流:{workflow_id},请使用 query_workflows 工具查询可用的工作流"
|
||||
|
||||
@@ -8,7 +8,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.chain.subscribe import SubscribeChain
|
||||
from app.db.oper.subscribe import SubscribeOper
|
||||
from app.application.agentdata import SubscribePort as SubscribeOper
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import media_type_to_agent
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.chain.search import SearchChain
|
||||
from app.db.oper.systemconfig import SystemConfigOper
|
||||
from app.application.configuration import get_configured_system_config as SystemConfigOper
|
||||
from app.application.site.sites import SitesHelper # pylint: disable=no-name-in-module
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import MediaSource, MediaType, SystemConfigKey
|
||||
|
||||
@@ -7,7 +7,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.chain.site import SiteChain
|
||||
from app.db.oper.site import SiteOper
|
||||
from app.application.agentdata import SitePort as SiteOper
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ from pydantic import BaseModel, Field, model_validator
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.runtime.config import settings
|
||||
from app.db.oper.agenttask import AgentTaskOper
|
||||
from app.application.agentdata import AgentTaskPort as AgentTaskOper
|
||||
from app.runtime.scheduling import TimerUtils
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.domain.metainfo import clear_rust_parse_options_cache
|
||||
from app.db.oper.systemconfig import SystemConfigOper
|
||||
from app.application.configuration import get_configured_system_config as SystemConfigOper
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import SystemConfigKey
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.agent.tools.impl._plugin_tool_utils import get_plugin_snapshot
|
||||
from app.runtime.extensions.plugin_manager import PluginManager
|
||||
from app.application.plugin.runtime import get_plugin_manager
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ class UpdatePluginConfigTool(MoviePilotTool):
|
||||
ensure_ascii=False,
|
||||
)
|
||||
|
||||
plugin_manager = PluginManager()
|
||||
plugin_manager = get_plugin_manager()
|
||||
current_config = dict(plugin_manager.get_plugin_config(plugin_id) or {})
|
||||
|
||||
# merge 模式以当前保存值为基准,replace 模式则从空配置开始重建。
|
||||
|
||||
@@ -8,7 +8,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.runtime.events import eventmanager
|
||||
from app.db.oper.site import SiteOper
|
||||
from app.application.agentdata import SitePort as SiteOper
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import EventType
|
||||
from app.foundation import url as url_tools
|
||||
|
||||
@@ -7,7 +7,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.chain.site import SiteChain
|
||||
from app.db.oper.site import SiteOper
|
||||
from app.application.agentdata import SitePort as SiteOper
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.runtime.events import eventmanager
|
||||
from app.db.oper.subscribe import SubscribeOper
|
||||
from app.application.agentdata import SubscribePort as SubscribeOper
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.event import SubscribeModifiedEventData
|
||||
from app.schemas.types import EventType, media_type_to_agent
|
||||
|
||||
@@ -18,7 +18,7 @@ from app.agent.tools.impl._system_setting_utils import (
|
||||
)
|
||||
from app.runtime.config import settings
|
||||
from app.runtime.events import eventmanager
|
||||
from app.db.oper.systemconfig import SystemConfigOper
|
||||
from app.application.configuration import get_configured_system_config as SystemConfigOper
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.event import ConfigChangeEventData
|
||||
from app.schemas.types import EventType
|
||||
|
||||
@@ -118,9 +118,9 @@ class MoviePilotToolsManager:
|
||||
self._load_tools_locked()
|
||||
return
|
||||
|
||||
from app.runtime.extensions.plugin_manager import PluginManager
|
||||
from app.application.plugin.runtime import get_plugin_manager
|
||||
|
||||
plugin_manager = PluginManager()
|
||||
plugin_manager = get_plugin_manager()
|
||||
if (
|
||||
self._plugin_agent_tools_revision
|
||||
== plugin_manager.get_plugin_agent_tools_revision()
|
||||
|
||||
Reference in New Issue
Block a user