diff --git a/pkg/core/stages/load_config.py b/pkg/core/stages/load_config.py index dc4e5edb..e602a7ba 100644 --- a/pkg/core/stages/load_config.py +++ b/pkg/core/stages/load_config.py @@ -5,7 +5,6 @@ import secrets from .. import stage, app from ..bootutils import config from ...config import settings as settings_mgr -from ...utils import schema @stage.stage_class("LoadConfigStage") @@ -30,7 +29,6 @@ class LoadConfigStage(stage.BootingStage): name="command.json", description="命令配置", manager=ap.command_cfg, - schema=schema.CONFIG_COMMAND_SCHEMA, doc_link="https://docs.langbot.app/config/function/command.html" ) @@ -38,7 +36,6 @@ class LoadConfigStage(stage.BootingStage): name="pipeline.json", description="消息处理流水线配置", manager=ap.pipeline_cfg, - schema=schema.CONFIG_PIPELINE_SCHEMA, doc_link="https://docs.langbot.app/config/function/pipeline.html" ) @@ -46,7 +43,6 @@ class LoadConfigStage(stage.BootingStage): name="platform.json", description="消息平台配置", manager=ap.platform_cfg, - schema=schema.CONFIG_PLATFORM_SCHEMA, doc_link="https://docs.langbot.app/config/function/platform.html" ) @@ -54,7 +50,6 @@ class LoadConfigStage(stage.BootingStage): name="provider.json", description="大模型能力配置", manager=ap.provider_cfg, - schema=schema.CONFIG_PROVIDER_SCHEMA, doc_link="https://docs.langbot.app/config/function/provider.html" ) @@ -62,7 +57,6 @@ class LoadConfigStage(stage.BootingStage): name="system.json", description="系统配置", manager=ap.system_cfg, - schema=schema.CONFIG_SYSTEM_SCHEMA, doc_link="https://docs.langbot.app/config/function/system.html" ) diff --git a/pkg/utils/schema.py b/pkg/utils/schema.py deleted file mode 100644 index 378cdf5b..00000000 --- a/pkg/utils/schema.py +++ /dev/null @@ -1,14 +0,0 @@ -import os -import json - - -def load_schema(schema_path: str) -> dict: - with open(schema_path, 'r', encoding='utf-8') as f: - return json.load(f) - - -CONFIG_SYSTEM_SCHEMA = load_schema("templates/schema/system.json") -CONFIG_PIPELINE_SCHEMA = load_schema("templates/schema/pipeline.json") -CONFIG_COMMAND_SCHEMA = load_schema("templates/schema/command.json") -CONFIG_PLATFORM_SCHEMA = load_schema("templates/schema/platform.json") -CONFIG_PROVIDER_SCHEMA = load_schema("templates/schema/provider.json") diff --git a/templates/schema/command.json b/templates/schema/command.json deleted file mode 100644 index 1cfc2541..00000000 --- a/templates/schema/command.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "object", - "layout": "expansion-panels", - "properties": { - "command-prefix": { - "type": "array", - "title": "命令前缀", - "description": "以数组形式设置,程序将前缀符合设置的消息视为命令(群内需要符合群响应规则)", - "items": { - "type": "string" - }, - "default": [ - "!", - "!" - ] - }, - "privilege": { - "type": "object", - "title": "权限管理", - "description": "设置每个命令的权限配置。普通用户权限级别为 1,管理员(system.json中设置的)权限级别为 2;在这里设置每个命令的最低权限级别,若设置为1,则用户和管理员均可用,若为2,则仅管理员可用;设置子命令时,以点号间隔,如\"plugin.on\"", - "properties": { - "placeholder": { - "type": "integer", - "minimum": 1, - "maximum": 2, - "const": 1 - } - }, - "patternProperties": { - "^[a-zA-Z0-9_.]+$": { - "type": "integer", - "minimum": 1, - "maximum": 2 - } - }, - "default": {} - } - } -} \ No newline at end of file diff --git a/templates/schema/pipeline.json b/templates/schema/pipeline.json deleted file mode 100644 index 787c9e71..00000000 --- a/templates/schema/pipeline.json +++ /dev/null @@ -1,326 +0,0 @@ -{ - "type": "object", - "layout": "expansion-panels", - "properties": { - "access-control": { - "type": "object", - "title": "访问控制", - "properties": { - "mode": { - "type": "string", - "title": "访问控制模式", - "description": "访问控制模式,支持黑名单和白名单", - "enum": [ - "blacklist", - "whitelist" - ], - "default": "blacklist" - }, - "blacklist": { - "type": "array", - "title": "黑名单", - "description": "黑名单中的会话将无法使用机器人,仅在访问控制模式为黑名单时有效。格式:{type}_{id},示例:group_12345678 或 person_12341234", - "items": { - "type": "string", - "format": "regex", - "pattern": "^(person|group)_.*$" - }, - "default": [] - }, - "whitelist": { - "type": "array", - "title": "白名单", - "description": "仅白名单中的会话可以使用机器人,仅在访问控制模式为白名单时有效。格式:{type}_{id},示例:group_12345678 或 person_12341234", - "items": { - "type": "string", - "format": "regex", - "pattern": "^(person|group)_.*$" - }, - "default": [] - } - }, - "required": [ - "mode" - ] - }, - "respond-rules": { - "type": "object", - "title": "群消息响应规则", - "description": "仅处理 访问控制 允许的会话的消息。所有未指定的群使用 默认响应规则,若需指定特定的群的规则,请输入 群号 并添加,并设置响应规则", - "properties": { - "default": { - "type": "object", - "title": "默认响应规则", - "properties": { - "at": { - "type": "boolean", - "title": "是否响应 @ 消息", - "layout": { - "comp": "switch", - "props": { - "color": "primary" - } - } - }, - "prefix": { - "type": "array", - "title": "响应前缀", - "description": "带有指定前缀的消息即使没有 at 机器人也会被响应,发送给 AI 时会删除前缀", - "items": { - "type": "string" - }, - "default": [] - }, - "regexp": { - "type": "array", - "title": "响应正则表达式", - "description": "正则表达式教程:https://www.runoob.com/regexp/regexp-syntax.html", - "items": { - "type": "string", - "format": "regex" - }, - "default": [] - }, - "random": { - "type": "number", - "title": "随机响应概率", - "description": "数值范围是0.0-1.0,对应概率0%-100%,为1.0时所有消息都响应", - "minimum": 0, - "maximum": 1, - "step": 0.01, - "layout": { - "comp": "slider", - "props": { - "color": "primary" - } - } - } - } - } - }, - "patternProperties": { - "^.*$": { - "type": "object", - "properties": { - "at": { - "type": "boolean", - "title": "是否响应 @ 消息", - "layout": { - "comp": "switch", - "props": { - "color": "primary" - } - } - }, - "prefix": { - "type": "array", - "title": "响应前缀", - "description": "带有指定前缀的消息即使没有 at 机器人也会被响应,发送给 AI 时会删除前缀", - "items": { - "type": "string" - }, - "default": [] - }, - "regexp": { - "type": "array", - "title": "响应正则表达式", - "description": "正则表达式教程:https://www.runoob.com/regexp/regexp-syntax.html", - "items": { - "type": "string", - "format": "regex" - }, - "default": [] - }, - "random": { - "type": "number", - "title": "随机响应概率", - "description": "数值范围是0.0-1.0,对应概率0%-100%,为1.0时所有消息都响应", - "minimum": 0, - "maximum": 1, - "step": 0.01, - "layout": { - "comp": "slider", - "props": { - "color": "primary" - } - } - } - } - } - } - }, - "income-msg-check": { - "type": "boolean", - "title": "检查传入消息内容", - "description": "是否对传入的消息(用户消息)进行检查,需配合审核策略使用(AI 响应内容一定会通过检查策略)", - "layout": { - "comp": "switch", - "props": { - "color": "primary" - } - } - }, - "ignore-rules": { - "type": "object", - "title": "传入消息忽略规则", - "description": "符合规则的传入消息将被忽略,仅传入消息检查被启用时生效", - "properties": { - "prefix": { - "type": "array", - "title": "忽略前缀", - "description": "具有指定前缀的消息将被忽略", - "items": { - "type": "string" - }, - "default": [] - }, - "regexp": { - "type": "array", - "title": "忽略正则表达式", - "description": "正则表达式教程:https://www.runoob.com/regexp/regexp-syntax.html", - "items": { - "type": "string", - "format": "regex" - }, - "default": [] - } - } - }, - "check-sensitive-words": { - "type": "boolean", - "title": "本地敏感词检查", - "description": "是否启用本地敏感词检查", - "layout": { - "comp": "switch", - "props": { - "color": "primary" - } - } - }, - "baidu-cloud-examine": { - "type": "object", - "title": "百度云内容审核配置", - "description": "百度云内容审核配置,前往:https://cloud.baidu.com/doc/ANTIPORN/index.html 获取 API Key 和 API Secret", - "properties": { - "enable": { - "type": "boolean", - "title": "是否启用", - "layout": { - "comp": "switch", - "props": { - "color": "primary" - } - } - }, - "api-key": { - "type": "string", - "title": "API Key", - "default": "" - }, - "api-secret": { - "type": "string", - "title": "API Secret", - "default": "" - } - } - }, - "rate-limit": { - "type": "object", - "title": "请求限速规则", - "properties": { - "strategy": { - "type": "string", - "title": "限速策略", - "description": "会话中的请求速率超过限制时的处理策略,drop为丢弃新请求,wait为等待请求速率降到限制以下", - "enum": [ - "drop", - "wait" - ], - "default": "drop" - }, - "algo": { - "type": "string", - "title": "限速算法", - "description": "目前仅支持 fixwin(固定窗口),支持插件扩展", - "enum": [ - "fixwin" - ], - "default": "fixwin" - }, - "fixwin": { - "type": "object", - "title": "固定窗口限速策略配置", - "description": "所有会话使用默认限速策略,若需指定特定会话的限速策略,请输入 会话名称(格式为 {type}_{id},示例:group_123456 或 person_123456) 并添加,以设置特定会话的限速参数", - "properties": { - "default": { - "type": "object", - "title": "默认限速策略", - "properties": { - "window-size": { - "type": "integer", - "title": "窗口大小(秒)", - "minimum": 1, - "default": 60 - }, - "limit": { - "type": "integer", - "title": "窗口期间允许的最大消息数", - "minimum": 1, - "default": 60 - } - } - } - }, - "patternProperties": { - "^(person|group).*$": { - "type": "object", - "title": "会话限速", - "properties": { - "window-size": { - "type": "integer", - "title": "窗口大小(秒)", - "minimum": 1, - "default": 60 - }, - "limit": { - "type": "integer", - "title": "窗口期间允许的最大消息数", - "minimum": 1, - "default": 60 - } - } - } - } - } - } - }, - "msg-truncate": { - "type": "object", - "title": "对话历史记录截断", - "description": "将在发送消息给模型之前对当前会话的历史消息进行截断,以限制传给模型的消息长度", - "properties": { - "method": { - "type": "string", - "title": "截断方法", - "description": "目前仅支持 round(按回合截断),支持插件扩展", - "enum": [ - "round" - ], - "default": "round" - }, - "round": { - "type": "object", - "title": "轮次截断策略配置", - "properties": { - "max-round": { - "type": "integer", - "title": "最大保留前文回合数", - "minimum": 1, - "default": 10 - } - } - } - } - } - } -} \ No newline at end of file diff --git a/templates/schema/platform.json b/templates/schema/platform.json deleted file mode 100644 index 4bc6f111..00000000 --- a/templates/schema/platform.json +++ /dev/null @@ -1,568 +0,0 @@ -{ - "type": "object", - "layout": "expansion-panels", - "properties": { - "platform-adapters": { - "type": "array", - "title": "消息平台适配器", - "default": {}, - "items": { - "type": "object", - "oneOf": [ - { - "title": "Nakuru 适配器", - "description": "用于接入 go-cqhttp", - "properties": { - "adapter": { - "type": "string", - "const": "nakuru" - }, - "enable": { - "type": "boolean", - "default": false, - "description": "是否启用此适配器", - "layout": { - "comp": "switch", - "props": { - "color": "primary" - } - } - }, - "host": { - "type": "string", - "default": "127.0.0.1" - }, - "ws_port": { - "type": "integer", - "default": 8080 - }, - "http_port": { - "type": "integer", - "default": 5700 - }, - "token": { - "type": "string", - "default": "" - } - } - }, - { - "title": "aiocqhttp 适配器", - "description": "用于接入 Lagrange 等兼容 OneBot v11 协议的机器人框架(仅支持反向ws)", - "properties": { - "adapter": { - "type": "string", - "const": "aiocqhttp" - }, - "enable": { - "type": "boolean", - "default": false, - "description": "是否启用此适配器", - "layout": { - "comp": "switch", - "props": { - "color": "primary" - } - } - }, - "host": { - "type": "string", - "default": "0.0.0.0", - "description": "监听的 IP 地址,一般就保持 0.0.0.0 就可以了。使用 aiocqhttp 时,LangBot 作为服务端被动等待框架连接,请在 Lagrange 等框架中设置被动 ws 地址或者反向 ws 地址(具体视框架而定)为 LangBot 监听的地址,且路径为/ws,例如:ws://127.0.0.1:2280/ws" - }, - "port": { - "type": "integer", - "default": 2290, - "description": "设置监听的端口,默认2280,需在 Lagrange 等框架中设置为与此处一致的端口" - }, - "access-token": { - "type": "string", - "default": "", - "description": "设置访问密钥,与 Lagrange 等框架中设置的保持一致" - } - } - }, - { - "title": "qq-botpy 适配器(WebSocket)", - "description": "用于接入 QQ 官方机器人 API", - "properties": { - "adapter": { - "type": "string", - "const": "qq-botpy" - }, - "enable": { - "type": "boolean", - "default": false, - "description": "是否启用此适配器", - "layout": { - "comp": "switch", - "props": { - "color": "primary" - } - } - }, - "appid": { - "type": "string", - "default": "", - "description": "申请到的QQ官方机器人的appid" - }, - "secret": { - "type": "string", - "default": "", - "description": "申请到的QQ官方机器人的secret" - }, - "intents": { - "type": "array", - "description": "控制监听的事件类型,需要填写才能接收到对应消息,目前支持的事件类型有:public_guild_messages(QQ 频道消息)、direct_message(QQ 频道私聊消息)、public_messages(QQ 群 和 列表私聊消息)", - "default": [ - "public_guild_messages", - "direct_message", - "public_messages" - ] - } - } - }, - { - "title": "QQ 官方适配器(WebHook)", - "description": "用于接入 QQ 官方机器人 API", - "properties": { - "adapter": { - "type": "string", - "const": "qqofficial" - }, - "enable": { - "type": "boolean", - "default": false, - "description": "是否启用此适配器", - "layout": { - "comp": "switch", - "props": { - "color": "primary" - } - } - }, - "appid": { - "type": "string", - "default": "", - "description": "申请到的QQ官方机器人的appid" - }, - "secret": { - "type": "string", - "default": "", - "description": "申请到的QQ官方机器人的secret" - }, - "port": { - "type": "integer", - "default": 2284, - "description": "监听的端口" - }, - "token": { - "type": "string", - "default": "", - "description": "申请到的QQ官方机器人的token" - } - } - }, - { - "title": "企业微信适配器", - "description": "用于接入企业微信", - "properties": { - "adapter": { - "type": "string", - "const": "wecom" - }, - "enable": { - "type": "boolean", - "default": false, - "description": "是否启用此适配器", - "layout": { - "comp": "switch", - "props": { - "color": "primary" - } - } - }, - "host": { - "type": "string", - "default": "0.0.0.0", - "description": "监听的IP地址" - }, - "port": { - "type": "integer", - "default": 2290, - "description": "监听的端口" - }, - "corpid": { - "type": "string", - "default": "", - "description": "企业微信的corpid" - }, - "secret": { - "type": "string", - "default": "", - "description": "企业微信的secret" - }, - "token": { - "type": "string", - "default": "", - "description": "企业微信的token" - }, - "EncodingAESKey": { - "type": "string", - "default": "", - "description": "企业微信的EncodingAESKey" - }, - "contacts_secret": { - "type": "string", - "default": "", - "description": "企业微信的contacts_secret" - } - } - }, - { - "title": "飞书适配器", - "description": "用于接入飞书", - "properties": { - "adapter": { - "type": "string", - "const": "lark" - }, - "enable": { - "type": "boolean", - "default": false, - "description": "是否启用此适配器", - "layout": { - "comp": "switch", - "props": { - "color": "primary" - } - } - }, - "app_id": { - "type": "string", - "default": "", - "description": "飞书的app_id" - }, - "app_secret": { - "type": "string", - "default": "", - "description": "飞书的app_secret" - }, - "bot_name": { - "type": "string", - "default": "", - "description": "飞书的bot_name" - }, - "enable-webhook": { - "type": "boolean", - "default": false, - "description": "是否启用webhook模式" - }, - "port": { - "type": "integer", - "description": "设置监听的端口,开启callback event时需要设置", - "default": 2285 - }, - "encrypt-key": { - "type": "string", - "default": "", - "description": "设置加密密钥" - } - } - }, - { - "title": "Discord 适配器", - "description": "用于接入 Discord", - "properties": { - "adapter": { - "type": "string", - "const": "discord" - }, - "enable": { - "type": "boolean", - "default": false, - "description": "是否启用此适配器", - "layout": { - "comp": "switch", - "props": { - "color": "primary" - } - } - }, - "client_id": { - "type": "string", - "default": "", - "description": "Discord 的 client_id" - }, - "token": { - "type": "string", - "default": "", - "description": "Discord 的 token" - } - } - }, - { - "title": "gewechat 适配器", - "description": "用于接入个人微信", - "properties": { - "adapter": { - "type": "string", - "const": "gewechat" - }, - "enable": { - "type": "boolean", - "default": false, - "description": "是否启用此适配器", - "layout": { - "comp": "switch", - "props": { - "color": "primary" - } - } - }, - "gewechat_url": { - "type": "string", - "default": "", - "description": "gewechat 的 url" - }, - "gewechat_file_url": { - "type": "string", - "default": "", - "description": "gewechat 文件下载URL" - }, - "port": { - "type": "integer", - "default": 2286, - "description": "gewechat 的端口" - }, - "callback_url": { - "type": "string", - "default": "", - "description": "回调地址(LangBot主机相对于gewechat服务器的地址)" - }, - "app_id": { - "type": "string", - "default": "", - "description": "gewechat 的 app_id" - }, - "token": { - "type": "string", - "default": "", - "description": "gewechat 的 token" - } - } - }, - { - "title": "微信公众号适配器", - "description": "用于接入微信公众号", - "properties": { - "adapter": { - "type": "string", - "const": "officialaccount" - }, - "enable": { - "type": "boolean", - "default": false, - "description": "是否启用此适配器" - }, - "token": { - "type": "string", - "default": "", - "description": "微信公众号的token" - }, - "EncodingAESKey": { - "type": "string", - "default": "", - "description": "微信公众号的EncodingAESKey" - }, - "AppID": { - "type": "string", - "default": "", - "description": "微信公众号的AppID" - }, - "AppSecret": { - "type": "string", - "default": "", - "description": "微信公众号的AppSecret" - }, - "Mode": { - "type": "string", - "default": "drop", - "description": "对于超过15s的响应的处理模式", - "enum": ["drop", "passive"] - }, - "LoadingMessage": { - "type": "string", - "default": "AI正在思考中,请发送任意内容获取回复。", - "description": "当使用被动模式时,显示给用户的提示信息" - }, - "host": { - "type": "string", - "default": "0.0.0.0", - "description": "监听的IP地址" - }, - "port": { - "type": "integer", - "default": 2287, - "description": "监听的端口" - } - } - }, - { - "title": "钉钉适配器", - "description": "用于接入钉钉", - "properties": { - "adapter": { - "type": "string", - "const": "dingtalk" - }, - "enable": { - "type": "boolean", - "default": false, - "description": "是否启用此适配器", - "layout": { - "comp": "switch", - "props": { - "color": "primary" - } - } - }, - "client_id": { - "type": "string", - "default": "", - "description": "钉钉的client_id" - }, - "client_secret": { - "type": "string", - "default": "", - "description": "钉钉的client_secret" - }, - "robot_code": { - "type": "string", - "default": "", - "description": "钉钉的robot_code" - }, - "robot_name": { - "type": "string", - "default": "", - "description": "钉钉的robot_name" - } - } - }, - { - "title": "Telegram 适配器", - "description": "用于接入 Telegram", - "properties": { - "adapter": { - "type": "string", - "const": "telegram" - }, - "enable": { - "type": "boolean", - "default": false, - "description": "是否启用此适配器" - }, - "token": { - "type": "string", - "default": "", - "description": "Telegram 的 token" - } - } - } - ] - } - }, - "track-function-calls": { - "type": "boolean", - "default": true, - "layout": { - "comp": "switch", - "props": { - "color": "primary" - } - }, - "title": "跟踪内容函数调用", - "description": "开启之后,在对话中调用的内容函数记录也会发给用户,关闭后(false)仅会发给用户最终结果" - }, - "quote-origin": { - "type": "boolean", - "default": false, - "layout": { - "comp": "switch", - "props": { - "color": "primary" - } - }, - "title": "引用原消息", - "description": "在群内回复时是否引用原消息" - }, - "at-sender": { - "type": "boolean", - "default": false, - "layout": { - "comp": "switch", - "props": { - "color": "primary" - } - }, - "title": "是否 at 原用户", - "description": "在群内回复时是否@发送者" - }, - "force-delay": { - "type": "object", - "default": { - "min": 0, - "max": 0 - }, - "title": "强制消息延迟范围", - "description": "在将响应内容发回给用户前的强制消息随机延迟时间范围,以防风控,单位是秒", - "properties": { - "min": { - "type": "integer", - "default": 0, - "description": "最小值,单位是秒" - }, - "max": { - "type": "integer", - "default": 0, - "description": "最大值,单位是秒" - } - } - }, - "long-text-process": { - "type": "object", - "title": "长消息处理策略", - "properties": { - "threshold": { - "type": "integer", - "default": 256, - "title": "长消息处理阈值", - "description": "当消息长度超过此阈值时,将启用长消息处理策略" - }, - "strategy": { - "type": "string", - "default": "forward", - "title": "长消息处理策略", - "description": "长消息处理策略,目前支持forward(转发消息组件)和image(文字转图片)。aiocqhttp 和 qq-botpy 不支持 forward 策略" - }, - "font-path": { - "type": "string", - "description": "image的渲染字体。未设置时,如果在windows下,会尝试寻找系统的微软雅黑字体,若找不到,则转为forward策略。未设置时,若不是windows系统,则直接转为forward策略", - "default": "" - } - } - }, - "hide-exception-info": { - "type": "boolean", - "default": true, - "layout": { - "comp": "switch", - "props": { - "color": "primary" - } - }, - "title": "向用户隐藏AI接口的异常信息", - "description": "是否向用户隐藏AI的异常信息,如果为true,当请求AI接口出现异常时,会返回一个错误的提示给用户。而把报错详情输出在控制台。" - } - } -} \ No newline at end of file diff --git a/templates/schema/provider.json b/templates/schema/provider.json deleted file mode 100644 index def2cc12..00000000 --- a/templates/schema/provider.json +++ /dev/null @@ -1,606 +0,0 @@ -{ - "type": "object", - "layout": "expansion-panels", - "properties": { - "enable-chat": { - "type": "boolean", - "default": true, - "title": "启用聊天功能", - "description": "是否启用 AI 聊天功能" - }, - "enable-vision": { - "type": "boolean", - "default": true, - "title": "启用视觉功能", - "description": "是否开启AI视觉功能。需要使用的模型同时支持视觉功能,详情见元数据板块" - }, - "keys": { - "type": "object", - "title": "模型接口密钥", - "description": "以字典的形式设置若干个密钥组,每个密钥组的键为密钥组名称,值为密钥列表。模型与密钥组的对应关系,请查看元数据板块", - "properties": { - "openai": { - "type": "array", - "title": "OpenAI API 密钥", - "items": { - "type": "string" - }, - "default": [] - }, - "anthropic": { - "type": "array", - "title": "Anthropic API 密钥", - "items": { - "type": "string" - }, - "default": [] - }, - "moonshot": { - "type": "array", - "title": "Moonshot API 密钥", - "items": { - "type": "string" - }, - "default": [] - }, - "deepseek": { - "type": "array", - "title": "DeepSeek API 密钥", - "items": { - "type": "string" - }, - "default": [] - }, - "gitee": { - "type": "array", - "title": "Gitee AI API 密钥", - "items": { - "type": "string" - }, - "default": [] - }, - "xai": { - "type": "array", - "title": "xAI API 密钥", - "items": { - "type": "string" - }, - "default": [] - }, - "zhipuai": { - "type": "array", - "title": "智谱AI API 密钥", - "items": { - "type": "string" - }, - "default": [] - }, - "siliconflow": { - "type": "array", - "title": "SiliconFlow API 密钥", - "items": { - "type": "string" - }, - "default": [] - }, - "bailian": { - "type": "array", - "title": "阿里云百炼大模型平台 API 密钥", - "items": { - "type": "string" - }, - "default": [] - }, - "volcark": { - "type": "array", - "title": "火山引擎大模型平台 API 密钥", - "items": { - "type": "string" - }, - "default": [] - } - } - }, - "requester": { - "type": "object", - "title": "大模型请求器", - "description": "以字典的形式设置若干个请求器,每个请求器的键为请求器名称,值为请求器配置。模型与请求器的对应关系,请查看元数据板块。实现请求器的方式,请查看插件编写教程", - "properties": { - "openai-chat-completions": { - "type": "object", - "title": "OpenAI API 请求配置", - "description": "仅可编辑 URL 和 超时时间,额外请求参数不支持可视化编辑,请到编辑器编辑", - "properties": { - "base-url": { - "type": "string", - "title": "API URL" - }, - "args": { - "type": "object", - "default": {} - }, - "timeout": { - "type": "number", - "title": "API 请求超时时间", - "default": 120 - } - } - }, - "anthropic-messages": { - "type": "object", - "title": "Anthropic API 请求配置", - "description": "仅可编辑 URL 和 超时时间,额外请求参数不支持可视化编辑,请到编辑器编辑", - "properties": { - "base-url": { - "type": "string", - "title": "API URL" - }, - "args": { - "type": "object", - "default": {} - }, - "timeout": { - "type": "number", - "title": "API 请求超时时间", - "default": 120 - } - } - }, - "moonshot-chat-completions": { - "type": "object", - "title": "Moonshot API 请求配置", - "description": "仅可编辑 URL 和 超时时间,额外请求参数不支持可视化编辑,请到编辑器编辑", - "properties": { - "base-url": { - "type": "string", - "title": "API URL" - }, - "args": { - "type": "object", - "default": {} - }, - "timeout": { - "type": "number", - "title": "API 请求超时时间", - "default": 120 - } - } - }, - "deepseek-chat-completions": { - "type": "object", - "title": "DeepSeek API 请求配置", - "description": "仅可编辑 URL 和 超时时间,额外请求参数不支持可视化编辑,请到编辑器编辑", - "properties": { - "base-url": { - "type": "string", - "title": "API URL" - }, - "args": { - "type": "object", - "default": {} - }, - "timeout": { - "type": "number", - "title": "API 请求超时时间", - "default": 120 - } - } - }, - "ollama-chat": { - "type": "object", - "title": "Ollama API 请求配置", - "description": "仅可编辑 URL 和 超时时间,额外请求参数不支持可视化编辑,请到编辑器编辑", - "properties": { - "base-url": { - "type": "string", - "title": "API URL" - }, - "args": { - "type": "object", - "default": {} - }, - "timeout": { - "type": "number", - "title": "API 请求超时时间", - "default": 600 - } - } - }, - "gitee-ai-chat-completions": { - "type": "object", - "title": "Gitee AI API 请求配置", - "description": "仅可编辑 URL 和 超时时间,额外请求参数不支持可视化编辑,请到编辑器编辑", - "properties": { - "base-url": { - "type": "string", - "title": "API URL" - }, - "args": { - "type": "object", - "default": {} - }, - "timeout": { - "type": "number", - "title": "API 请求超时时间", - "default": 120 - } - } - }, - "xai-chat-completions": { - "type": "object", - "title": "xAI API 请求配置", - "description": "仅可编辑 URL 和 超时时间,额外请求参数不支持可视化编辑,请到编辑器编辑", - "properties": { - "base-url": { - "type": "string", - "title": "API URL" - }, - "args": { - "type": "object", - "default": {} - }, - "timeout": { - "type": "number", - "title": "API 请求超时时间", - "default": 120 - } - } - }, - "zhipuai-chat-completions": { - "type": "object", - "title": "智谱AI API 请求配置", - "description": "仅可编辑 URL 和 超时时间,额外请求参数不支持可视化编辑,请到编辑器编辑", - "properties": { - "base-url": { - "type": "string", - "title": "API URL" - }, - "args": { - "type": "object", - "default": {} - }, - "timeout": { - "type": "number", - "default": 120 - } - } - }, - "lmstudio-chat-completions": { - "type": "object", - "title": "LMStudio API 请求配置", - "description": "仅可编辑 URL 和 超时时间,额外请求参数不支持可视化编辑,请到编辑器编辑", - "properties": { - "base-url": { - "type": "string", - "title": "API URL" - }, - "args": { - "type": "object", - "default": {} - }, - "timeout": { - "type": "number", - "title": "API 请求超时时间", - "default": 120 - } - } - }, - "siliconflow-chat-completions": { - "type": "object", - "title": "SiliconFlow API 请求配置", - "description": "仅可编辑 URL 和 超时时间,额外请求参数不支持可视化编辑,请到编辑器编辑", - "properties": { - "base-url": { - "type": "string", - "title": "API URL" - }, - "args": { - "type": "object", - "default": {} - }, - "timeout": { - "type": "number", - "title": "API 请求超时时间", - "default": 120 - } - } - }, - "bailian-chat-completions": { - "type": "object", - "title": "阿里云百炼大模型平台 API 请求配置", - "description": "仅可编辑 URL 和 超时时间,额外请求参数不支持可视化编辑,请到编辑器编辑", - "properties": { - "base-url": { - "type": "string", - "title": "API URL" - }, - "args": { - "type": "object", - "default": {} - }, - "timeout": { - "type": "number", - "title": "API 请求超时时间", - "default": 120 - } - } - }, - "volcark-chat-completions": { - "type": "object", - "title": "火山方舟大模型平台 API 请求配置", - "description": "仅可编辑 URL 和 超时时间,额外请求参数不支持可视化编辑,请到编辑器编辑", - "properties": { - "base-url": { - "type": "string", - "title": "API URL" - }, - "args": { - "type": "object", - "default": {} - }, - "timeout": { - "type": "number", - "title": "API 请求超时时间", - "default": 120 - } - } - } - } - }, - "model": { - "type": "string", - "title": "所使用的模型名称", - "description": "设置要使用的模型名称。通常来说直接填写模型名称即可,但如果要使用原生接口不是 ChatCompletion 但以 ChatCompletion 接口格式接入的模型,请在模型名称前方加一个 OneAPI/ 前缀以进行区分。 简单来说可以认为是:现阶段非 OpenAI 的模型接入都需要在模型名称前方加一个 OneAPI/ 前缀。\n\n例如:\n\n1. 通过 OneAPI 等中转服务接入了 OpenAI 的 gpt-4 模型,由于 gpt-4 也是使用 ChatCompletion 接口格式进行请求,则可以直接填入 gpt-4;\n2. 通过 OneAPI 等中转服务接入了 Google 的 gemini-pro 模型,由于 gemini-pro 原生接口格式并非 ChatCompletion,因此需要填入 OneAPI/gemini-pro。\n具体支持的模型列表和各个模型对应的请求器和密钥组,请查看元数据板块 llm-models.json " - }, - "prompt-mode": { - "type": "string", - "title": "情景预设(人格)模式", - "description": "值为normal(单预设模式)和full-scenario(完整历史对话模式);normal模式时,使用下方设置的情景预设,也支持读取data/prompts目录下的文件内容作为单个 System Prompt,文件名即为prompt的名称;full-scenario模式时,读取 data/scenario/ 下的完整历史对话作为情景预设", - "enum": ["normal", "full-scenario"], - "default": "normal" - }, - "prompt": { - "type": "object", - "title": "情景预设(人格)", - "description": "设置情景预设(人格)。值为空字符串时,将不使用情景预设(人格)。normal模式时,使用下方设置的情景预设,也支持读取data/prompts目录下的文件内容作为单个 System Prompt,文件名即为prompt的名称;full-scenario模式时,读取 data/scenario/ 下的完整历史对话作为情景预设", - "properties": { - "default": { - "type": "string", - "title": "默认情景预设", - "description": "设置默认情景预设。值为空字符串时,将不使用情景预设(人格)", - "default": "" - } - }, - "patternProperties": { - "^.*$": { - "type": "string", - "title": "情景预设", - "description": "设置情景预设。值为空字符串时,将不使用情景预设(人格)", - "default": "" - } - }, - "required": ["default"] - }, - "runner": { - "type": "string", - "title": "请求运行器", - "description": "设置请求运行器。值为local-agent时,使用内置默认运行器;支持插件扩展", - "default": "local-agent" - }, - "dify-service-api": { - "type": "object", - "title": "Dify Service API 配置", - "properties": { - "base-url": { - "type": "string", - "title": "API URL", - "description": "Dify Service API 的 基础URL,可以在 Dify 应用 API 页面查看", - "default": "https://api.dify.ai/v1" - }, - "app-type": { - "type": "string", - "title": "应用类型", - "description": "支持 chat 和 workflow,chat:聊天助手(含高级编排)和 Agent;workflow:工作流;请填写下方对应的应用类型 API 参数", - "enum": ["chat", "workflow", "agent"], - "default": "chat" - }, - "options": { - "type": "object", - "title": "Dify Service API 配置选项", - "properties": { - "convert-thinking-tips": { - "type": "string", - "title": "转换思考提示", - "description": "设置转换思考提示。值为 original 时,不转换思考提示;值为 plain 时,将思考提示转换为类似 DeepSeek 官方的...格式;值为 remove 时,删除思考提示", - "enum": ["original", "plain", "remove"], - "default": "plain" - } - } - }, - - "chat": { - "type": "object", - "title": "聊天助手 API 参数", - "properties": { - "api-key": { - "type": "string", - "title": "API 密钥" - }, - "timeout": { - "type": "number", - "title":"API 请求超时时间" - } - } - }, - "agent": { - "type": "object", - "title": "Agent API 参数", - "properties": { - "api-key": { - "type": "string", - "title": "API 密钥" - }, - "timeout": { - "type": "number", - "title":"API 请求超时时间" - } - } - }, - "workflow": { - "type": "object", - "title": "工作流 API 参数", - "properties": { - "api-key": { - "type": "string", - "title": "API 密钥" - }, - "output-key": { - "type": "string", - "title": "工作流输出键", - "description": "设置工作流输出键,用于从 Dify Workflow 结束节点返回的 JSON 数据中提取输出内容", - "default": "summary" - }, - "timeout": { - "type": "number", - "title": "API 请求超时时间" - } - } - } - } - }, - "dashscope-app-api": { - "type": "object", - "title": "阿里百炼平台自建应用 API 配置", - "properties": { - "app-type": { - "type": "string", - "title": "应用类型", - "description": "支持 workflow 和 agent,workflow:智能体编排;agent:普通智能体;请填写下方对应的应用类型 API 参数", - "enum": ["workflow", "agent"], - "default": "agent" - }, - "api-key": { - "type": "string", - "title": "API 密钥" - }, - "agent": { - "type": "object", - "title": "Agent API 参数", - "properties": { - "app-id": { - "type": "string", - "title": "应用 ID" - }, - "references_quote": { - "type": "string", - "title": "参考资料引用", - "description": "设置参考资料引用,用于从 Dashscope App API 结束节点返回的 JSON 数据中提取引用内容", - "default": "参考资料来自:" - } - } - }, - "workflow": { - "type": "object", - "title": "工作流 API 参数", - "properties": { - "app-id": { - "type": "string", - "title": "应用 ID" - }, - "references_quote": { - "type": "string", - "title": "参考资料引用", - "default": "参考资料来自:" - }, - "biz_params": { - "type": "object", - "title": "传入参数", - "default": {} - } - } - } - } - }, - "mcp": { - "type": "object", - "title": "MCP 配置", - "properties": { - "servers": { - "type": "array", - "title": "MCP 服务器配置", - "default": [], - "items": { - "type": "object", - "oneOf": [ - { - "title": "Stdio 模式服务器", - "properties": { - "mode": { - "type": "string", - "title": "模式", - "const": "stdio" - }, - "enable": { - "type": "boolean", - "title": "启用" - }, - "name": { - "type": "string", - "title": "名称" - }, - "command": { - "type": "string", - "title": "启动命令" - }, - "args": { - "type": "array", - "title": "启动参数", - "items": { - "type": "string" - }, - "default": [] - }, - "env": { - "type": "object", - "default": {} - } - } - }, - { - "title": "SSE 模式服务器", - "properties": { - "mode": { - "type": "string", - "title": "模式", - "const": "sse" - }, - "enable": { - "type": "boolean", - "title": "启用" - }, - "name": { - "type": "string", - "title": "名称" - }, - "url": { - "type": "string", - "title": "URL" - }, - "headers": { - "type": "object", - "default": {} - }, - "timeout": { - "type": "number", - "title": "请求超时时间", - "default": 10 - } - } - } - ] - } - } - } - } - } -} \ No newline at end of file diff --git a/templates/schema/system.json b/templates/schema/system.json deleted file mode 100644 index 85f46e71..00000000 --- a/templates/schema/system.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "type": "object", - "layout": "expansion-panels", - "properties": { - "admin-sessions": { - "type": "array", - "title": "管理员会话", - "description": "设置管理员会话,格式为 {type}_{id},type 为 \"group\" 或 \"person\",如:group_123456 或 person_123456", - "items": { - "type": "string", - "format": "regex", - "pattern": "^(person|group)_.*$" - }, - "default": [] - }, - "network-proxies": { - "type": "object", - "title": "网络代理", - "description": "正向代理,http和https都要填,例如:http://127.0.0.1:7890 https://127.0.0.1:7890 。不使用代理请留空。正向代理也可以用环境变量设置:http_proxy 和 https_proxy", - "properties": { - "http": { - "type": "string" - }, - "https": { - "type": "string" - } - } - }, - "report-usage": { - "type": "boolean", - "title": "上报遥测数据", - "description": "遥测数据用于统计和分析项目使用情况,不包含任何隐私信息,不建议禁用", - "layout": { - "comp": "switch", - "props": { - "color": "primary" - } - } - }, - "logging-level": { - "type": "string", - "title": "日志等级", - "description": "目前无效,启用调试模式请设置环境变量:export DEBUG=true" - }, - "session-concurrency": { - "type": "object", - "title": "会话消息处理并发数", - "description": "粒度是单个会话,所有会话使用默认并发数,若需指定特定会话的并发数,请输入 会话名称(格式为 {type}_{id},示例:group_123456 或 person_123456) 并添加,以设置特定会话的并发数", - "properties": { - "default": { - "type": "integer" - } - }, - "patternProperties": { - "^(person|group)_.*$": { - "type": "integer" - } - } - }, - "pipeline-concurrency": { - "type": "integer", - "title": "流水线消息处理并发数", - "description": "粒度是整个程序,目前使用 FCFS 算法调度各个请求" - }, - "qcg-center-url": { - "type": "string", - "title": "遥测服务器地址", - "description": "运行期间推送遥测数据的目标地址,默认为官方地址,若您自己部署了 https://github.com/RockChinQ/qcg-center,可以改为你的地址。" - }, - "help-message": { - "type": "string", - "title": "帮助消息", - "description": "用户发送 !help 命令时的输出", - "layout": "textarea" - }, - "http-api": { - "type": "object", - "title": "HTTP 接口", - "properties": { - "enable": { - "type": "boolean", - "layout": { - "comp": "switch", - "props": { - "color": "primary" - } - }, - "title": "是否启用" - }, - "host": { - "type": "string" - }, - "port": { - "type": "integer" - }, - "jwt-expire": { - "type": "integer", - "title": "JWT 过期时间", - "description": "单位:秒" - } - } - }, - "persistence": { - "type": "object", - "title": "持久化设置", - "properties": { - "sqlite": { - "type": "object", - "title": "sqlite", - "properties": { - "path": { - "type": "string" - } - } - }, - "use": { - "type": "string", - "title": "所使用的数据库", - "enum": [ - "sqlite" - ] - } - } - } - } -} \ No newline at end of file