refactor: 清理冗余代码并现代化导入语句
- 将 `typing.Awaitable` 和 `typing.Callable` 的导入更新为 `collections.abc`,以遵循 Python 3.9+ 的最佳实践。 - 移除了 `sorted()` 函数中不必要的 `set` 到 `list` 的转换。 - 清理了 `plugin_system/__init__.py` 中不再需要公开的 `__all__` 条目。
This commit is contained in:
committed by
Windpicker-owo
parent
a1b718a0c5
commit
5fa004503c
@@ -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] = []
|
||||
|
||||
@@ -78,11 +78,9 @@ __all__ = [
|
||||
# 消息
|
||||
"MaiMessages",
|
||||
# 工具函数
|
||||
"ManifestValidator",
|
||||
"PluginInfo",
|
||||
# 增强命令系统
|
||||
"PlusCommand",
|
||||
"PlusCommandAdapter",
|
||||
"PythonDependency",
|
||||
"ToolInfo",
|
||||
"ToolParamType",
|
||||
|
||||
Reference in New Issue
Block a user