Perf webhook (#3406)

* perf: plugin webhook

* perf: plugin webhook
This commit is contained in:
Archer
2024-12-16 16:44:39 +08:00
committed by GitHub
parent 8e9c030600
commit 8ba339e78f
16 changed files with 439 additions and 211 deletions

View File

@@ -5,7 +5,15 @@ import { cloneDeep } from 'lodash';
import { WorkerNameEnum, runWorker } from '@fastgpt/service/worker/utils';
// Run in main thread
const staticPluginList = ['getTime', 'fetchUrl', 'feishu', 'google', 'bing'];
const staticPluginList = [
'getTime',
'fetchUrl',
'feishu',
'DingTalkWebhook',
'WeWorkWebhook',
'google',
'bing'
];
// Run in worker thread (Have npm packages)
const packagePluginList = [
'mathExprVal',

View File

@@ -1,8 +1,8 @@
{
"author": "",
"version": "4816",
"name": "钉钉机器人 webhook",
"avatar": "/appMarketTemplates/plugin-dingtalk/avatar.svg",
"name": "钉钉 webhook",
"avatar": "plugins/dingding",
"intro": "向钉钉机器人发起 webhook 请求。",
"courseUrl": "https://open.dingtalk.com/document/robots/custom-robot-access",
"showStatus": false,
@@ -19,8 +19,8 @@
"flowNodeType": "pluginInput",
"showStatus": false,
"position": {
"x": 535.7465806305546,
"y": -201.26482361861054
"x": 557.4542421888484,
"y": -131.2827008898969
},
"version": "481",
"inputs": [
@@ -43,25 +43,49 @@
"renderTypeList": ["input"],
"required": true,
"canEdit": true,
"value": ""
"value": "",
"list": []
},
{
"key": "发送的消息",
"renderTypeList": ["input", "reference"],
"selectedTypeIndex": 0,
"valueType": "string",
"label": "发送的消息",
"renderTypeList": ["reference"],
"required": true,
"description": "",
"canEdit": true,
"value": "",
"editField": {
"key": true
},
"dynamicParamDefaultValue": {
"inputType": "reference",
"valueType": "string",
"required": true
}
"key": "加签值",
"label": "加签值",
"description": "钉钉机器人加签值",
"defaultValue": "",
"list": [
{
"label": "",
"value": ""
}
],
"maxFiles": 5,
"canSelectFile": true,
"canSelectImg": true,
"required": true
},
{
"renderTypeList": ["input", "reference"],
"selectedTypeIndex": 0,
"valueType": "string",
"canEdit": true,
"key": "发送的消息",
"label": "发送的消息",
"description": "发送的消息",
"defaultValue": "",
"list": [
{
"label": "",
"value": ""
}
],
"maxFiles": 5,
"canSelectFile": true,
"canSelectImg": true,
"required": true,
"toolDescription": "发送的消息"
}
],
"outputs": [
@@ -73,11 +97,18 @@
"type": "static"
},
{
"id": "p0m68Dv5KaIp",
"key": "发送的消息",
"id": "srcret",
"valueType": "string",
"key": "加签值",
"label": "加签值",
"type": "hidden"
},
{
"id": "发送的消息",
"valueType": "string",
"key": "发送的消息",
"label": "发送的消息",
"type": "static"
"type": "hidden"
}
]
},
@@ -89,8 +120,8 @@
"flowNodeType": "pluginOutput",
"showStatus": false,
"position": {
"x": 1776.027569211593,
"y": -58.264823618610535
"x": 2420.0305926489386,
"y": -106.28270088989689
},
"version": "481",
"inputs": [],
@@ -104,8 +135,8 @@
"flowNodeType": "httpRequest468",
"showStatus": true,
"position": {
"x": 1069.7228495148624,
"y": -392.26482361861054
"x": 1645.779103978597,
"y": -431.7827008898969
},
"version": "481",
"inputs": [
@@ -170,7 +201,7 @@
"description": "common:core.module.input.description.Http Request Url",
"placeholder": "https://api.ai.com/getInventory",
"required": false,
"value": "{{url}}",
"value": "{{$a5qdMS7ECNYE.qLUQfhG0ILRX$}}",
"debugLabel": "",
"toolDescription": ""
},
@@ -200,7 +231,7 @@
"key": "system_httpJsonBody",
"renderTypeList": ["hidden"],
"valueType": "any",
"value": "{\r\n \"msgtype\": \"text\",\r\n \"text\": {\r\n \"content\": \"{{text}}\"\r\n }\r\n}",
"value": "{\r\n \"msgtype\": \"text\",\r\n \"text\": {\r\n \"content\": \"{{$pluginInput.发送的消息$}}\"\r\n }\r\n}",
"label": "",
"required": false,
"debugLabel": "",
@@ -225,74 +256,6 @@
"required": false,
"debugLabel": "",
"toolDescription": ""
},
{
"key": "text",
"valueType": "string",
"label": "text",
"renderTypeList": ["reference"],
"description": "",
"canEdit": true,
"editField": {
"key": true,
"valueType": true
},
"value": ["pluginInput", "p0m68Dv5KaIp"],
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"arrayAny",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": true
}
},
{
"key": "url",
"valueType": "string",
"label": "url",
"renderTypeList": ["reference"],
"description": "",
"canEdit": true,
"editField": {
"key": true,
"valueType": true
},
"value": ["pluginInput", "mv52BrPVE6bm"],
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"arrayAny",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": true
}
}
],
"outputs": [
@@ -339,21 +302,235 @@
"version": "4811",
"inputs": [],
"outputs": []
},
{
"nodeId": "a5qdMS7ECNYE",
"name": "代码运行",
"intro": "执行一段简单的脚本代码,通常用于进行复杂的数据处理。",
"avatar": "core/workflow/template/codeRun",
"flowNodeType": "code",
"showStatus": true,
"position": {
"x": 1106.1011901190363,
"y": -407.7827008898969
},
"version": "482",
"inputs": [
{
"key": "system_addInputParam",
"renderTypeList": ["addInputParam"],
"valueType": "dynamic",
"label": "",
"required": false,
"description": "workflow:these_variables_will_be_input_parameters_for_code_execution",
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"arrayAny",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": true
},
"valueDesc": "",
"debugLabel": "",
"toolDescription": ""
},
{
"key": "codeType",
"renderTypeList": ["hidden"],
"label": "",
"value": "js",
"valueDesc": "",
"description": "",
"debugLabel": "",
"toolDescription": ""
},
{
"key": "code",
"renderTypeList": ["custom"],
"label": "",
"value": "function main({url, secret}){\n const {sign,timestamp} = createHmac('sha256',secret)\n\n return {\n result: `${url}&timestamp=${timestamp}&sign=${sign}`\n }\n}",
"valueDesc": "",
"description": "",
"debugLabel": "",
"toolDescription": ""
},
{
"renderTypeList": ["reference"],
"valueType": "string",
"canEdit": true,
"key": "url",
"label": "url",
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"arrayAny",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": true
},
"required": true,
"value": ["pluginInput", "mv52BrPVE6bm"]
},
{
"renderTypeList": ["reference"],
"valueType": "string",
"canEdit": true,
"key": "secret",
"label": "secret",
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"arrayAny",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": true
},
"required": true,
"value": ["pluginInput", "srcret"]
}
],
"outputs": [
{
"id": "system_rawResponse",
"key": "system_rawResponse",
"label": "workflow:full_response_data",
"valueType": "object",
"type": "static",
"description": ""
},
{
"id": "error",
"key": "error",
"label": "workflow:execution_error",
"description": "代码运行错误信息,成功时返回空",
"valueType": "object",
"type": "static"
},
{
"id": "system_addOutputParam",
"key": "system_addOutputParam",
"type": "dynamic",
"valueType": "dynamic",
"label": "",
"customFieldConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"arrayAny",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": false
},
"description": "将代码中 return 的对象作为输出,传递给后续的节点。变量名需要对应 return 的 key",
"valueDesc": ""
},
{
"id": "qLUQfhG0ILRX",
"type": "dynamic",
"key": "result",
"valueType": "string",
"label": "result",
"valueDesc": "",
"description": ""
}
]
}
],
"edges": [
{
"source": "pluginInput",
"target": "rKBYGQuYefae",
"sourceHandle": "pluginInput-source-right",
"targetHandle": "rKBYGQuYefae-target-left"
},
{
"source": "rKBYGQuYefae",
"target": "pluginOutput",
"sourceHandle": "rKBYGQuYefae-source-right",
"targetHandle": "pluginOutput-target-left"
},
{
"source": "pluginInput",
"target": "a5qdMS7ECNYE",
"sourceHandle": "pluginInput-source-right",
"targetHandle": "a5qdMS7ECNYE-target-left"
},
{
"source": "a5qdMS7ECNYE",
"target": "rKBYGQuYefae",
"sourceHandle": "a5qdMS7ECNYE-source-right",
"targetHandle": "rKBYGQuYefae-target-left"
}
]
],
"chatConfig": {
"welcomeText": "",
"variables": [],
"questionGuide": false,
"ttsConfig": {
"type": "web"
},
"whisperConfig": {
"open": false,
"autoSend": false,
"autoTTSResponse": false
},
"chatInputGuide": {
"open": false,
"textList": [],
"customUrl": ""
},
"instruction": "",
"autoExecute": {
"open": false,
"defaultPrompt": ""
},
"_id": "6710a5619c45325525326719"
}
}
}

View File

@@ -1,9 +1,9 @@
{
"author": "",
"version": "4816",
"name": "企业微信机器人 webhook",
"avatar": "/appMarketTemplates/plugin-wework/avatar.svg",
"intro": "向企业微信机器人发起 webhook 请求。",
"name": "企业微信 webhook",
"avatar": "plugins/qiwei",
"intro": "向企业微信机器人发起 webhook 请求。只能内部群使用。",
"courseUrl": "https://developer.work.weixin.qq.com/document/path/91770",
"showStatus": false,
"weight": 10,
@@ -19,7 +19,7 @@
"flowNodeType": "pluginInput",
"showStatus": false,
"position": {
"x": 535.7465806305546,
"x": 537.6357458754286,
"y": -201.26482361861054
},
"version": "481",
@@ -49,9 +49,9 @@
"key": "发送的消息",
"valueType": "string",
"label": "发送的消息",
"renderTypeList": ["reference"],
"renderTypeList": ["input", "reference"],
"required": true,
"description": "",
"description": "发送的消息",
"canEdit": true,
"value": "",
"editField": {
@@ -61,7 +61,10 @@
"inputType": "reference",
"valueType": "string",
"required": true
}
},
"list": [],
"defaultValue": "",
"toolDescription": "发送的消息"
}
],
"outputs": [
@@ -354,6 +357,30 @@
"sourceHandle": "rKBYGQuYefae-source-right",
"targetHandle": "pluginOutput-target-left"
}
]
],
"chatConfig": {
"welcomeText": "",
"variables": [],
"questionGuide": false,
"ttsConfig": {
"type": "web"
},
"whisperConfig": {
"open": false,
"autoSend": false,
"autoTTSResponse": false
},
"chatInputGuide": {
"open": false,
"textList": [],
"customUrl": ""
},
"instruction": "",
"autoExecute": {
"open": false,
"defaultPrompt": ""
},
"_id": "6710a5619c45325525326719"
}
}
}

View File

@@ -1,7 +1,7 @@
{
"author": "",
"version": "488",
"name": "飞书机器人 webhook",
"name": "飞书 webhook",
"avatar": "/appMarketTemplates/plugin-feishu/avatar.svg",
"intro": "向飞书机器人发起 webhook 请求。",
"courseUrl": "https://open.feishu.cn/document/client-docs/bot-v3/add-custom-bot#f62e72d5",
@@ -27,7 +27,7 @@
"version": "481",
"inputs": [
{
"renderTypeList": ["reference"],
"renderTypeList": ["input", "reference"],
"selectedTypeIndex": 0,
"valueType": "string",
"canEdit": true,
@@ -35,7 +35,9 @@
"label": "content",
"description": "需要发送的消息",
"required": true,
"toolDescription": "需要发送的消息"
"toolDescription": "需要发送的消息",
"list": [],
"defaultValue": ""
},
{
"renderTypeList": ["input"],
@@ -46,7 +48,8 @@
"label": "hook_url",
"description": "飞书机器人地址",
"required": true,
"defaultValue": ""
"defaultValue": "",
"list": []
}
],
"outputs": [
@@ -508,6 +511,30 @@
"sourceHandle": "qcJpBBVtXsGd-source-right",
"targetHandle": "vzreK6vHrPvZ-target-left"
}
]
],
"chatConfig": {
"welcomeText": "",
"variables": [],
"questionGuide": false,
"ttsConfig": {
"type": "web"
},
"whisperConfig": {
"open": false,
"autoSend": false,
"autoTTSResponse": false
},
"chatInputGuide": {
"open": false,
"textList": [],
"customUrl": ""
},
"instruction": "",
"autoExecute": {
"open": false,
"defaultPrompt": ""
},
"_id": "6710a5619c45325525326719"
}
}
}

View File

@@ -341,7 +341,9 @@ export const iconPaths = {
'phoneTabbar/me': () => import('./icons/phoneTabbar/me.svg'),
'phoneTabbar/tool': () => import('./icons/phoneTabbar/tool.svg'),
'phoneTabbar/toolFill': () => import('./icons/phoneTabbar/toolFill.svg'),
'plugins/dingding': () => import('./icons/plugins/dingding.svg'),
'plugins/doc2x': () => import('./icons/plugins/doc2x.svg'),
'plugins/qiwei': () => import('./icons/plugins/qiwei.svg'),
'plugins/textEditor': () => import('./icons/plugins/textEditor.svg'),
point: () => import('./icons/point.svg'),
preview: () => import('./icons/preview.svg'),

View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1734061835557" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4251" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512.003 79C272.855 79 79 272.855 79 512.003 79 751.145 272.855 945 512.003 945 751.145 945 945 751.145 945 512.003 945 272.855 751.145 79 512.003 79z m200.075 375.014c-0.867 3.764-3.117 9.347-6.234 16.012h0.087l-0.347 0.648c-18.183 38.86-65.631 115.108-65.631 115.108l-0.215-0.52-13.856 24.147h66.8L565.063 779l29.002-115.368h-52.598l18.27-76.29c-14.76 3.55-32.253 8.436-52.945 15.1 0 0-27.967 16.36-80.607-31.5 0 0-35.501-31.29-14.891-39.078 8.744-3.33 42.466-7.573 69.004-11.122 35.93-4.845 57.965-7.441 57.965-7.441s-110.607 1.643-136.841-2.468c-26.237-4.11-59.525-47.905-66.626-86.377 0 0-10.953-21.117 23.595-11.122 34.547 10 177.535 38.95 177.535 38.95s-185.933-56.992-198.36-70.929c-12.381-13.846-36.406-75.902-33.289-113.981 0 0 1.343-9.521 11.127-6.926 0 0 137.49 62.75 231.475 97.152 94.028 34.403 175.76 51.885 165.2 96.414z" fill="#3AA2EB" p-id="4252"></path></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1734061855126" class="icon" viewBox="0 0 1219 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5425" xmlns:xlink="http://www.w3.org/1999/xlink" width="238.0859375" height="200"><path d="M966.168 275.578a429.202 429.202 0 0 0-77.41-110.397c-80.822-83.944-193.95-138.02-318.61-152.26a583.655 583.655 0 0 0-65.926-3.827c-20.284 0-41.545 1.195-63.097 3.584C316.05 26.258 202.265 80.19 120.856 164.06a429.641 429.641 0 0 0-77.824 110.227A385.829 385.829 0 0 0 3.048 445.074c0 76.313 23.113 151.382 66.803 217.356 22.138 33.427 58.344 75.484 91.673 105.204l-15.068 118.833c-0.585 1.585-1.194 3.17-1.584 4.9-0.415 1.61-0.488 3.195-0.634 4.804-0.098 1.194-0.415 2.389-0.415 3.584 0 1.316 0.317 2.608 0.415 3.9a38.522 38.522 0 0 0 38.205 34.865c6.973 0 13.41-2.023 19.017-5.217l0.585-0.39c0.78-0.39 1.658-0.878 2.438-1.39l35.962-18.14 107.081-54.052a550.687 550.687 0 0 0 93.574 18.09 576.123 576.123 0 0 0 128.975-0.39 559.47 559.47 0 0 0 126.343-29.622 69.973 69.973 0 0 1-47.446-73.192 468.114 468.114 0 0 1-89.575 19.261 482.987 482.987 0 0 1-108.106 0.317c-3.584-0.39-7.265-0.975-10.922-1.463a475.404 475.404 0 0 1-70.851-14.994 48.299 48.299 0 0 0-14.726-2.268c-7.973 0-15.604 2.073-23.406 6.096-1.048 0.61-2 1.048-3.048 1.609l-87.942 52.053-3.852 2.292c-1.877 1.195-2.999 1.585-3.998 1.585a5.973 5.973 0 0 1-5.803-6.071l3.389-13.775 3.803-14.97 6.461-24.527 7.07-27.405c4.877-15.189-0.487-31.792-13.287-41.252a394.679 394.679 0 0 1-36.742-31.037 362.57 362.57 0 0 1-52.15-61.928c-34.622-52.224-52.859-111.494-52.859-171.447 0-46.494 10.582-91.745 31.452-134.436a344.795 344.795 0 0 1 62.488-88.26c66.877-69.022 160.987-113.322 264.948-124.635 18.042-1.999 35.84-2.974 52.858-2.974 17.92 0 36.474 1.073 55.247 3.17 103.521 11.824 197.071 56.32 263.436 125.342a344.21 344.21 0 0 1 62.098 88.478c20.359 41.448 30.964 87.04 31.037 133.267 0 4.803-0.317 9.606-0.536 14.384a69.34 69.34 0 0 1 85.577 9.997c1.22 1.194 2.121 2.51 3.17 3.754a360.28 360.28 0 0 0 1.219-29.574 385.829 385.829 0 0 0-39.254-169.326" fill="#0082F0" p-id="5426"></path><path d="M961.39 884.59a67.462 67.462 0 0 0-8.339-1.39 213.87 213.87 0 0 1-119.32-66.706 16.579 16.579 0 0 0-28.062 9.533 16.725 16.725 0 0 0 6.826 16.042l4.755 4.779a215.503 215.503 0 0 1 58.806 110.25 69.778 69.778 0 0 0 51.737 63.318 69.51 69.51 0 0 0 67.096-18.164 70.217 70.217 0 0 0 17.725-68.778 69.925 69.925 0 0 0-51.322-48.957" fill="#FB6500" p-id="5427"></path><path d="M1192.058 705.853a69.486 69.486 0 0 0-72.607-16.506 69.851 69.851 0 0 0-46.03 58.685 215.381 215.381 0 0 1-66.366 119.71 16.823 16.823 0 0 0 9.265 28.892 16.701 16.701 0 0 0 16.213-7.558l4.706-4.803a213.821 213.821 0 0 1 109.787-59.1 69.949 69.949 0 0 0 63.098-52.004 70.217 70.217 0 0 0-18.066-67.414" fill="#0082F0" p-id="5428"></path><path d="M896.902 507.928a70.217 70.217 0 0 0-16.36 72.802 69.876 69.876 0 0 0 58.32 46.3 213.821 213.821 0 0 1 119.271 66.681 16.677 16.677 0 0 0 28.477-9.484 16.798 16.798 0 0 0-7.216-16.189 215.479 215.479 0 0 1-63.684-115.03 69.778 69.778 0 0 0-51.638-63.317 69.51 69.51 0 0 0-67.17 18.14" fill="#2DBC00" p-id="5429"></path><path d="M817.81 766.464l0.585-4.242a215.576 215.576 0 0 1 66.414-119.833 16.823 16.823 0 0 0-9.24-28.891 16.701 16.701 0 0 0-16.238 7.558 213.797 213.797 0 0 1-114.493 63.927 69.949 69.949 0 0 0-63.098 52.004 70.217 70.217 0 0 0 18.066 67.414 69.486 69.486 0 0 0 70.486 17.066 69.827 69.827 0 0 0 47.445-55.003" fill="#FFCC00" p-id="5430"></path></svg>

After

Width:  |  Height:  |  Size: 3.5 KiB