add:新增文档变更
This commit is contained in:
@@ -217,6 +217,20 @@ class ActionPlanner(BasePlanner):
|
||||
# 如果repair_json直接返回了字典对象,直接使用
|
||||
parsed_json = fixed_json_string
|
||||
|
||||
# 处理repair_json可能返回列表的情况
|
||||
if isinstance(parsed_json, list):
|
||||
if parsed_json:
|
||||
# 取列表中最后一个元素(通常是最完整的)
|
||||
parsed_json = parsed_json[-1]
|
||||
logger.warning(f"{self.log_prefix}LLM返回了多个JSON对象,使用最后一个: {parsed_json}")
|
||||
else:
|
||||
parsed_json = {}
|
||||
|
||||
# 确保parsed_json是字典
|
||||
if not isinstance(parsed_json, dict):
|
||||
logger.error(f"{self.log_prefix}解析后的JSON不是字典类型: {type(parsed_json)}")
|
||||
parsed_json = {}
|
||||
|
||||
# 提取决策,提供默认值
|
||||
extracted_action = parsed_json.get("action", "no_reply")
|
||||
extracted_reasoning = ""
|
||||
|
||||
@@ -3,6 +3,7 @@ import os
|
||||
import importlib
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
import traceback
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from src.plugin_system.base.base_plugin import BasePlugin
|
||||
@@ -151,6 +152,7 @@ class PluginManager:
|
||||
|
||||
except ValueError as e:
|
||||
# manifest文件格式错误或验证失败
|
||||
traceback.print_exc()
|
||||
total_failed_registration += 1
|
||||
error_msg = f"manifest验证失败: {str(e)}"
|
||||
self.failed_plugins[plugin_name] = error_msg
|
||||
|
||||
@@ -351,7 +351,7 @@ class CoreActionsPlugin(BasePlugin):
|
||||
|
||||
# 配置节描述
|
||||
config_section_descriptions = {
|
||||
"plugin": "插件基本信息配置",
|
||||
"plugin": "插件启用配置",
|
||||
"components": "核心组件启用配置",
|
||||
"no_reply": "不回复动作配置",
|
||||
"emoji": "表情动作配置",
|
||||
@@ -360,12 +360,7 @@ class CoreActionsPlugin(BasePlugin):
|
||||
# 配置Schema定义
|
||||
config_schema = {
|
||||
"plugin": {
|
||||
"name": ConfigField(type=str, default="core_actions", description="插件名称", required=True),
|
||||
"version": ConfigField(type=str, default="1.0.0", description="插件版本号"),
|
||||
"enabled": ConfigField(type=bool, default=True, description="是否启用插件"),
|
||||
"description": ConfigField(
|
||||
type=str, default="系统核心动作插件,提供基础聊天交互功能", description="插件描述", required=True
|
||||
),
|
||||
},
|
||||
"components": {
|
||||
"enable_reply": ConfigField(type=bool, default=True, description="是否启用'回复'动作"),
|
||||
|
||||
Reference in New Issue
Block a user