移动使用文档位置,添加小棉插件开关配置项

This commit is contained in:
2024-12-16 01:31:42 +08:00
parent 11d5af1144
commit 86f0e395f3
9 changed files with 188 additions and 306 deletions

10
nonebot_plugin_marshoai/azure.py Executable file → Normal file
View File

@ -106,9 +106,13 @@ async def _preload_tools():
@driver.on_startup
async def _preload_plugins():
"""启动钩子加载插件"""
marshoai_plugin_dirs = config.marshoai_plugin_dirs # 外部插件目录列表
marshoai_plugin_dirs.insert(0, Path(__file__).parent / "plugins") # 预置插件目录
load_plugins(*marshoai_plugin_dirs)
if config.marshoai_enable_plugins:
marshoai_plugin_dirs = config.marshoai_plugin_dirs # 外部插件目录列表
marshoai_plugin_dirs.insert(0, Path(__file__).parent / "plugins") # 预置插件目录
load_plugins(*marshoai_plugin_dirs)
logger.info(
"如果启用小棉插件后使用的模型出现报错,请尝试将 MARSHOAI_ENABLE_PLUGINS 设为 false。"
)
@add_usermsg_cmd.handle()

3
nonebot_plugin_marshoai/config.py Executable file → Normal file
View File

@ -36,7 +36,8 @@ class ConfigModel(BaseModel):
marshoai_enable_support_image_tip: bool = True
marshoai_enable_praises: bool = True
marshoai_enable_time_prompt: bool = True
marshoai_enable_tools: bool = True
marshoai_enable_tools: bool = False
marshoai_enable_plugins: bool = True
marshoai_load_builtin_tools: bool = True
marshoai_toolset_dir: list = []
marshoai_disabled_toolkits: list = []

9
nonebot_plugin_marshoai/config_example.yaml Executable file → Normal file
View File

@ -34,7 +34,9 @@ marshoai_enable_support_image_tip: true # 是否启用支持图片提示。
marshoai_enable_praises: true # 是否启用夸赞名单功能。
marshoai_enable_tools: true # 是否启用工具支持。
marshoai_enable_tools: false # 是否启用工具支持。
marshoai_enable_plugins: true # 是否启用插件功能。
marshoai_load_builtin_tools: true # 是否加载内置工具。
@ -42,6 +44,10 @@ marshoai_toolset_dir: [] # 工具集路径。
marshoai_disabled_toolkits: [] # 已禁用的工具包列表。
marshoai_plugin_dirs: [] # 插件路径。
marshoai_devmode: false # 是否启用开发者模式。
marshoai_azure_endpoint: "https://models.inference.ai.azure.com" # OpenAI 标准格式 API 的端点。
# 模型参数配置
@ -54,3 +60,4 @@ marshoai_additional_image_models: [] # 额外的图片模型列表,默认空
# 腾讯云的API密钥未设置时为空。
marshoai_tencent_secretid: null
marshoai_tencent_secretkey: null

4
nonebot_plugin_marshoai/plugin/__init__.py Executable file → Normal file
View File

@ -1,4 +1,4 @@
"""该功能目前正在开发中,暂时不可用,受影响的文件夹 `plugin`, `plugins`
"""该功能目前~~正在开发中~~开发基本完成,暂时~~不~~可用,受影响的文件夹 `plugin`, `plugins`
"""
from nonebot import logger
@ -8,4 +8,4 @@ from .load import *
from .models import *
from .utils import *
logger.opt(colors=True).info("<y>MarshoAI 插件功能开发中,用户请忽略相关日志</y>")
#logger.opt(colors=True).info("<y>MarshoAI 插件功能开发中,用户请忽略相关日志</y>")