修复typing,但是保留疑问

This commit is contained in:
UnCLAS-Prommer
2025-06-23 13:47:11 +08:00
parent 5ba36dab45
commit 8e2b7523e6
6 changed files with 57 additions and 51 deletions

View File

@@ -34,7 +34,7 @@ class BaseAction(ABC):
chat_stream=None,
log_prefix: str = "",
shutting_down: bool = False,
plugin_config: dict = None,
plugin_config: dict = {},
**kwargs,
):
"""初始化Action组件

View File

@@ -1,6 +1,6 @@
from enum import Enum
from typing import Dict, Any, List
from dataclasses import dataclass
from dataclasses import dataclass, field
# 组件类型枚举
@@ -64,7 +64,7 @@ class ComponentInfo:
enabled: bool = True # 是否启用
plugin_name: str = "" # 所属插件名称
is_built_in: bool = False # 是否为内置组件
metadata: Dict[str, Any] = None # 额外元数据
metadata: Dict[str, Any] = field(default_factory=dict) # 额外元数据
def __post_init__(self):
if self.metadata is None:
@@ -79,13 +79,13 @@ class ActionInfo(ComponentInfo):
normal_activation_type: ActionActivationType = ActionActivationType.ALWAYS
random_activation_probability: float = 0.0
llm_judge_prompt: str = ""
activation_keywords: List[str] = None
activation_keywords: List[str] = field(default_factory=list) # 激活关键词列表
keyword_case_sensitive: bool = False
mode_enable: ChatMode = ChatMode.ALL
parallel_action: bool = False
action_parameters: Dict[str, Any] = None
action_require: List[str] = None
associated_types: List[str] = None
action_parameters: Dict[str, Any] = field(default_factory=dict) # 动作参数
action_require: List[str] = field(default_factory=list) # 动作需求说明
associated_types: List[str] = field(default_factory=list) # 关联的消息类型
def __post_init__(self):
super().__post_init__()
@@ -106,7 +106,7 @@ class CommandInfo(ComponentInfo):
command_pattern: str = "" # 命令匹配模式(正则表达式)
command_help: str = "" # 命令帮助信息
command_examples: List[str] = None # 命令使用示例
command_examples: List[str] = field(default_factory=list) # 命令使用示例
intercept_message: bool = True # 是否拦截消息处理(默认拦截)
def __post_init__(self):
@@ -126,18 +126,18 @@ class PluginInfo:
author: str = "" # 插件作者
enabled: bool = True # 是否启用
is_built_in: bool = False # 是否为内置插件
components: List[ComponentInfo] = None # 包含的组件列表
dependencies: List[str] = None # 依赖的其他插件
python_dependencies: List[PythonDependency] = None # Python包依赖
components: List[ComponentInfo] = field(default_factory=list) # 包含的组件列表
dependencies: List[str] = field(default_factory=list) # 依赖的其他插件
python_dependencies: List[PythonDependency] = field(default_factory=list) # Python包依赖
config_file: str = "" # 配置文件路径
metadata: Dict[str, Any] = None # 额外元数据
metadata: Dict[str, Any] = field(default_factory=dict) # 额外元数据
# 新增manifest相关信息
manifest_data: Dict[str, Any] = None # manifest文件数据
manifest_data: Dict[str, Any] = field(default_factory=dict) # manifest文件数据
license: str = "" # 插件许可证
homepage_url: str = "" # 插件主页
repository_url: str = "" # 插件仓库地址
keywords: List[str] = None # 插件关键词
categories: List[str] = None # 插件分类
keywords: List[str] = field(default_factory=list) # 插件关键词
categories: List[str] = field(default_factory=list) # 插件分类
min_host_version: str = "" # 最低主机版本要求
max_host_version: str = "" # 最高主机版本要求