feat: 完成 pipeline 的可视化配置

This commit is contained in:
Junyan Qin
2024-10-16 13:57:41 +08:00
parent fb308d576b
commit 18cce189a4
2 changed files with 295 additions and 106 deletions

View File

@@ -10,12 +10,15 @@
"type": "string",
"title": "访问控制模式",
"description": "访问控制模式,支持黑名单和白名单",
"enum": ["blacklist", "whitelist"]
"enum": [
"blacklist",
"whitelist"
]
},
"blacklist": {
"type": "array",
"title": "黑名单",
"description": "黑名单中的会话将无法使用机器人,仅在访问控制模式为黑名单时有效",
"description": "黑名单中的会话将无法使用机器人,仅在访问控制模式为黑名单时有效。格式:{type}_{id}示例group_12345678 或 person_12341234",
"items": {
"type": "string",
"format": "regex",
@@ -25,7 +28,7 @@
"whitelist": {
"type": "array",
"title": "白名单",
"description": "仅白名单中的会话可以使用机器人,仅在访问控制模式为白名单时有效",
"description": "仅白名单中的会话可以使用机器人,仅在访问控制模式为白名单时有效。格式:{type}_{id}示例group_12345678 或 person_12341234",
"items": {
"type": "string",
"format": "regex",
@@ -33,11 +36,14 @@
}
}
},
"required": ["mode"]
"required": [
"mode"
]
},
"respond-rules": {
"type": "object",
"title": "群响应规则",
"title": "群消息响应规则",
"description": "仅处理 访问控制 允许的会话的消息。所有未指定的群使用 默认响应规则,若需指定特定的群的规则,请输入 群号 并添加,并设置响应规则",
"properties": {
"default": {
"type": "object",
@@ -55,14 +61,16 @@
},
"prefix": {
"type": "array",
"title": "前缀响应",
"title": "响应前缀",
"description": "带有指定前缀的消息即使没有 at 机器人也会被响应,发送给 AI 时会删除前缀",
"items": {
"type": "string"
}
},
"regexp": {
"type": "array",
"title": "正则表达式响应",
"title": "响应正则表达式",
"description": "正则表达式教程https://www.runoob.com/regexp/regexp-syntax.html",
"items": {
"type": "string",
"format": "regex"
@@ -71,6 +79,7 @@
"random": {
"type": "number",
"title": "随机响应概率",
"description": "数值范围是0.0-1.0对应概率0%-100%为1.0时所有消息都响应",
"minimum": 0,
"maximum": 1,
"step": 0.01,
@@ -85,7 +94,7 @@
}
},
"patternProperties": {
"^(person|group).*$": {
"^\\d+$": {
"type": "object",
"properties": {
"at": {
@@ -100,14 +109,16 @@
},
"prefix": {
"type": "array",
"title": "前缀响应",
"title": "响应前缀",
"description": "带有指定前缀的消息即使没有 at 机器人也会被响应,发送给 AI 时会删除前缀",
"items": {
"type": "string"
}
},
"regexp": {
"type": "array",
"title": "正则表达式响应",
"title": "响应正则表达式",
"description": "正则表达式教程https://www.runoob.com/regexp/regexp-syntax.html",
"items": {
"type": "string",
"format": "regex"
@@ -116,6 +127,7 @@
"random": {
"type": "number",
"title": "随机响应概率",
"description": "数值范围是0.0-1.0对应概率0%-100%为1.0时所有消息都响应",
"minimum": 0,
"maximum": 1,
"step": 0.01,
@@ -129,6 +141,175 @@
}
}
}
},
"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"
}
},
"regexp": {
"type": "array",
"title": "忽略正则表达式",
"description": "正则表达式教程https://www.runoob.com/regexp/regexp-syntax.html",
"items": {
"type": "string",
"format": "regex"
}
}
}
},
"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"
},
"api-secret": {
"type": "string",
"title": "API Secret"
}
}
},
"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
}
}
}
}
}
}
}

View File

@@ -2,111 +2,119 @@
"type": "object",
"layout": "expansion-panels",
"properties": {
"admin-sessions": {
"type": "array",
"title": "管理员会话",
"description": "",
"items": {
"type": "string",
"format": "regex",
"pattern": "^(person|group)_(\\d)*$"
}
},
"network-proxies": {
"type": "object",
"title": "网络代理",
"properties": {
"http": {
"type": "string"
},
"https": {
"type": "string"
}
}
},
"report-usage": {
"type": "boolean",
"title": "是否上报遥测数据",
"layout": {
"comp": "switch",
"props": {
"color": "primary"
"admin-sessions": {
"type": "array",
"title": "管理员会话",
"description": "设置管理员会话,格式为 {type}_{id}type 为 \"group\" 或 \"person\"group_123456 或 person_123456",
"items": {
"type": "string",
"format": "regex",
"pattern": "^(person|group)_(\\d+)$"
}
}
},
"logging-level": {
"type": "string",
"title": "日志等级"
},
"session-concurrency": {
"type": "object",
"title": "会话并行消息数",
"properties": {
"default": {
"type": "integer",
"title": "会话默认并行消息数"
}
},
"patternProperties": {
"^(person|group).*$": {
"type": "integer"
}
}
},
"pipeline-concurrency": {
"type": "integer",
"title": "全局并行消息数"
},
"qcg-center-url": {
"type": "string",
"title": "遥测服务器地址"
},
"help-message": {
"type": "string",
"title": "help 命令消息",
"layout": "textarea"
},
"http-api": {
"type": "object",
"title": "HTTP 接口",
"properties": {
"enable": {
"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"
}
},
"title": "是否启用"
},
"host": {
"type": "string"
},
"port": {
"type": "integer"
}
}
},
"persistence": {
"type": "object",
"title": "持久化设置",
"properties": {
"sqlite": {
"type": "object",
"title": "sqlite",
"properties": {
"path": {
"type": "string"
}
}
},
"use": {
},
"logging-level": {
"type": "string",
"title": "所使用的数据库",
"enum": ["sqlite"]
}
"title": "日志等级",
"description": "目前无效启用调试模式请设置环境变量export DEBUG=true"
},
"session-concurrency": {
"type": "object",
"title": "会话消息处理并发数",
"description": "粒度是单个会话,所有会话使用默认并发数,若需指定特定会话的并发数,请输入 会话名称(格式为 {type}_{id}示例group_123456 或 person_123456 并添加,以设置特定会话的并发数",
"properties": {
"default": {
"type": "integer"
}
},
"patternProperties": {
"^(person|group)_(\\d+)$": {
"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"
}
}
},
"persistence": {
"type": "object",
"title": "持久化设置",
"properties": {
"sqlite": {
"type": "object",
"title": "sqlite",
"properties": {
"path": {
"type": "string"
}
}
},
"use": {
"type": "string",
"title": "所使用的数据库",
"enum": [
"sqlite"
]
}
}
}
}
}
}
}