From 5fa004503c2137ece0116595e342fa7f20ed4f31 Mon Sep 17 00:00:00 2001 From: minecraft1024a Date: Wed, 12 Nov 2025 12:47:55 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=B8=85=E7=90=86=E5=86=97?= =?UTF-8?q?=E4=BD=99=E4=BB=A3=E7=A0=81=E5=B9=B6=E7=8E=B0=E4=BB=A3=E5=8C=96?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 `typing.Awaitable` 和 `typing.Callable` 的导入更新为 `collections.abc`,以遵循 Python 3.9+ 的最佳实践。 - 移除了 `sorted()` 函数中不必要的 `set` 到 `list` 的转换。 - 清理了 `plugin_system/__init__.py` 中不再需要公开的 `__all__` 条目。 --- src/chat/utils/prompt_component_manager.py | 4 ++-- src/plugin_system/__init__.py | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/chat/utils/prompt_component_manager.py b/src/chat/utils/prompt_component_manager.py index 0aa1ce275..0e0cbefe4 100644 --- a/src/chat/utils/prompt_component_manager.py +++ b/src/chat/utils/prompt_component_manager.py @@ -1,7 +1,7 @@ import asyncio import copy import re -from typing import Awaitable, Callable +from collections.abc import Awaitable, Callable from src.chat.utils.prompt import global_prompt_manager from src.chat.utils.prompt_params import PromptParameters @@ -301,7 +301,7 @@ class PromptComponentManager: async with self._lock: # 合并所有动态规则的目标和所有核心提示词,确保所有潜在目标都被包含 all_targets = set(self._dynamic_rules.keys()) | set(self.get_core_prompts()) - for target in sorted(list(all_targets)): + for target in sorted(all_targets): rules = self._dynamic_rules.get(target, {}) if not rules: injection_map[target] = [] diff --git a/src/plugin_system/__init__.py b/src/plugin_system/__init__.py index 4ff982d06..7c4d6c9ed 100644 --- a/src/plugin_system/__init__.py +++ b/src/plugin_system/__init__.py @@ -78,11 +78,9 @@ __all__ = [ # 消息 "MaiMessages", # 工具函数 - "ManifestValidator", "PluginInfo", # 增强命令系统 "PlusCommand", - "PlusCommandAdapter", "PythonDependency", "ToolInfo", "ToolParamType",