feat(data-models): 使用 __slots__ 优化内存占用和属性访问性能,更新多个数据模型
This commit is contained in:
@@ -16,7 +16,7 @@ class InjectionType(Enum):
|
||||
return self.value
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class InjectionRule:
|
||||
"""Prompt注入规则"""
|
||||
|
||||
@@ -118,7 +118,7 @@ class EventType(Enum):
|
||||
return self.value
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class PythonDependency:
|
||||
"""Python包依赖信息"""
|
||||
|
||||
@@ -139,7 +139,7 @@ class PythonDependency:
|
||||
return self.install_name
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class PermissionNodeField:
|
||||
"""权限节点声明字段"""
|
||||
|
||||
@@ -147,7 +147,7 @@ class PermissionNodeField:
|
||||
description: str # 权限描述
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class AdapterInfo:
|
||||
"""适配器组件信息"""
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from dataclasses import dataclass, field
|
||||
from typing import Any
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class ConfigField:
|
||||
"""配置字段定义"""
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ from typing import Any
|
||||
from src.plugin_system.base.component_types import PythonDependency
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class PluginMetadata:
|
||||
"""
|
||||
插件元数据,用于存储插件的开发者信息和用户帮助信息。
|
||||
|
||||
@@ -15,7 +15,7 @@ from src.common.logger import get_logger
|
||||
logger = get_logger("stream_tool_history")
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class ToolCallRecord:
|
||||
"""工具调用记录"""
|
||||
tool_name: str
|
||||
|
||||
@@ -17,7 +17,7 @@ from src.plugin_system.core.stream_tool_history import ToolCallRecord, get_strea
|
||||
logger = get_logger("tool_use")
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class ToolExecutionConfig:
|
||||
"""工具执行配置"""
|
||||
max_concurrent_tools: int = 5 # 最大并发工具数量
|
||||
@@ -25,7 +25,7 @@ class ToolExecutionConfig:
|
||||
enable_dependency_check: bool = True # 是否启用依赖检查
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class ToolExecutionResult:
|
||||
"""工具执行结果"""
|
||||
tool_call: ToolCall
|
||||
|
||||
Reference in New Issue
Block a user