diff --git a/packages/plugins/register.ts b/packages/plugins/register.ts index d36e1e006..41c17355c 100644 --- a/packages/plugins/register.ts +++ b/packages/plugins/register.ts @@ -13,6 +13,7 @@ const staticPluginList = [ 'WeWorkWebhook', 'google', 'bing', + 'bocha', 'delay' ]; // Run in worker thread (Have npm packages) diff --git a/packages/plugins/src/bocha/template.json b/packages/plugins/src/bocha/template.json new file mode 100644 index 000000000..dc84bf4ec --- /dev/null +++ b/packages/plugins/src/bocha/template.json @@ -0,0 +1,677 @@ +{ + "author": "", + "name": "博查搜索", + "avatar": "core/workflow/template/bocha", + "intro": "使用博查AI搜索引擎进行网络搜索。", + "showStatus": true, + "weight": 10, + "courseUrl": "", + "isTool": true, + "templateType": "search", + "workflow": { + "nodes": [ + { + "nodeId": "pluginInput", + "name": "workflow:template.plugin_start", + "intro": "workflow:intro_plugin_input", + "avatar": "core/workflow/template/workflowStart", + "flowNodeType": "pluginInput", + "showStatus": false, + "position": { + "x": 636.3048409085379, + "y": -238.61714728578016 + }, + "version": "481", + "inputs": [ + { + "renderTypeList": [ + "input" + ], + "selectedTypeIndex": 0, + "valueType": "string", + "canEdit": true, + "key": "apiKey", + "label": "apiKey", + "description": "博查API密钥", + "defaultValue": "", + "required": true + }, + { + "renderTypeList": [ + "input", + "reference" + ], + "selectedTypeIndex": 0, + "valueType": "string", + "canEdit": true, + "key": "query", + "label": "query", + "description": "搜索查询词", + "defaultValue": "", + "required": true, + "toolDescription": "搜索查询词" + }, + { + "renderTypeList": [ + "input", + "reference" + ], + "selectedTypeIndex": 0, + "valueType": "string", + "canEdit": true, + "key": "freshness", + "label": "freshness", + "description": "搜索指定时间范围内的网页。可填值:oneDay(一天内)、oneWeek(一周内)、oneMonth(一个月内)、oneYear(一年内)、noLimit(不限,默认)、YYYY-MM-DD..YYYY-MM-DD(日期范围)、YYYY-MM-DD(指定日期)", + "defaultValue": "noLimit", + "required": false, + "toolDescription": "搜索时间范围" + }, + { + "renderTypeList": [ + "input", + "reference" + ], + "selectedTypeIndex": 0, + "valueType": "boolean", + "canEdit": true, + "key": "summary", + "label": "summary", + "description": "是否显示文本摘要。true显示,false不显示(默认)", + "defaultValue": false, + "required": false, + "toolDescription": "是否显示文本摘要" + }, + { + "renderTypeList": [ + "input", + "reference" + ], + "selectedTypeIndex": 0, + "valueType": "string", + "canEdit": true, + "key": "include", + "label": "include", + "description": "指定搜索的site范围。多个域名使用|或,分隔,最多20个。例如:qq.com|m.163.com", + "defaultValue": "", + "required": false, + "toolDescription": "指定搜索的site范围" + }, + { + "renderTypeList": [ + "input", + "reference" + ], + "selectedTypeIndex": 0, + "valueType": "string", + "canEdit": true, + "key": "exclude", + "label": "exclude", + "description": "排除搜索的网站范围。多个域名使用|或,分隔,最多20个。例如:qq.com|m.163.com", + "defaultValue": "", + "required": false, + "toolDescription": "排除搜索的网站范围" + }, + { + "renderTypeList": [ + "input", + "reference" + ], + "selectedTypeIndex": 0, + "valueType": "number", + "canEdit": true, + "key": "count", + "label": "count", + "description": "返回结果的条数。可填范围:1-50,默认为10", + "defaultValue": 10, + "required": false, + "min": 1, + "max": 50, + "toolDescription": "返回结果条数" + } + ], + "outputs": [ + { + "id": "apiKey", + "valueType": "string", + "key": "apiKey", + "label": "apiKey", + "type": "hidden" + }, + { + "id": "query", + "valueType": "string", + "key": "query", + "label": "query", + "type": "hidden" + }, + { + "id": "freshness", + "valueType": "string", + "key": "freshness", + "label": "freshness", + "type": "hidden" + }, + { + "id": "summary", + "valueType": "boolean", + "key": "summary", + "label": "summary", + "type": "hidden" + }, + { + "id": "include", + "valueType": "string", + "key": "include", + "label": "include", + "type": "hidden" + }, + { + "id": "exclude", + "valueType": "string", + "key": "exclude", + "label": "exclude", + "type": "hidden" + }, + { + "id": "count", + "valueType": "number", + "key": "count", + "label": "count", + "type": "hidden" + } + ] + }, + { + "nodeId": "pluginOutput", + "name": "common:core.module.template.self_output", + "intro": "workflow:intro_custom_plugin_output", + "avatar": "core/workflow/template/pluginOutput", + "flowNodeType": "pluginOutput", + "showStatus": false, + "position": { + "x": 2764.1105686698083, + "y": -30.617147285780163 + }, + "version": "481", + "inputs": [ + { + "renderTypeList": [ + "reference" + ], + "valueType": "object", + "canEdit": true, + "key": "result", + "label": "result", + "isToolOutput": true, + "description": "", + "value": [ + "nyA6oA8mF1iW", + "httpRawResponse" + ] + } + ], + "outputs": [] + }, + { + "nodeId": "pluginConfig", + "name": "common:core.module.template.system_config", + "intro": "", + "avatar": "core/workflow/template/systemConfig", + "flowNodeType": "pluginConfig", + "position": { + "x": 184.66337662472682, + "y": -216.05298493910115 + }, + "version": "4811", + "inputs": [], + "outputs": [] + }, + { + "nodeId": "nyA6oA8mF1iW", + "name": "HTTP 请求", + "intro": "调用博查搜索API", + "avatar": "core/workflow/template/httpRequest", + "flowNodeType": "httpRequest468", + "showStatus": true, + "position": { + "x": 1335.0647252518884, + "y": -455.9043948565971 + }, + "version": "481", + "inputs": [ + { + "key": "system_addInputParam", + "renderTypeList": [ + "addInputParam" + ], + "valueType": "dynamic", + "label": "", + "required": false, + "description": "common:core.module.input.description.HTTP Dynamic Input", + "customInputConfig": { + "selectValueTypeList": [ + "string", + "number", + "boolean", + "object", + "arrayString", + "arrayNumber", + "arrayBoolean", + "arrayObject", + "arrayAny", + "any", + "chatHistory", + "datasetQuote", + "dynamic", + "selectDataset", + "selectApp" + ], + "showDescription": false, + "showDefaultValue": true + }, + "debugLabel": "", + "toolDescription": "" + }, + { + "key": "system_httpMethod", + "renderTypeList": [ + "custom" + ], + "valueType": "string", + "label": "", + "value": "POST", + "required": true, + "debugLabel": "", + "toolDescription": "" + }, + { + "key": "system_httpTimeout", + "renderTypeList": [ + "custom" + ], + "valueType": "number", + "label": "", + "value": 30, + "min": 5, + "max": 600, + "required": true, + "debugLabel": "", + "toolDescription": "" + }, + { + "key": "system_httpReqUrl", + "renderTypeList": [ + "hidden" + ], + "valueType": "string", + "label": "", + "description": "common:core.module.input.description.Http Request Url", + "placeholder": "https://api.ai.com/getInventory", + "required": false, + "value": "https://api.bochaai.com/v1/web-search", + "debugLabel": "", + "toolDescription": "" + }, + { + "key": "system_httpHeader", + "renderTypeList": [ + "custom" + ], + "valueType": "any", + "value": [ + { + "key": "Authorization", + "type": "string", + "value": "Bearer {{$pluginInput.apiKey$}}" + }, + { + "key": "Content-Type", + "type": "string", + "value": "application/json" + } + ], + "label": "", + "description": "common:core.module.input.description.Http Request Header", + "placeholder": "common:core.module.input.description.Http Request Header", + "required": false, + "debugLabel": "", + "toolDescription": "" + }, + { + "key": "system_httpParams", + "renderTypeList": [ + "hidden" + ], + "valueType": "any", + "value": [], + "label": "", + "required": false, + "debugLabel": "", + "toolDescription": "" + }, + { + "key": "system_httpJsonBody", + "renderTypeList": [ + "hidden" + ], + "valueType": "any", + "value": "{\n \"query\": \"{{query}}\",\n \"freshness\": \"{{freshness}}\",\n \"summary\": {{summary}},\n \"include\": \"{{include}}\",\n \"exclude\": \"{{exclude}}\",\n \"count\": {{count}}\n}", + "label": "", + "required": false, + "debugLabel": "", + "toolDescription": "" + }, + { + "key": "system_httpFormBody", + "renderTypeList": [ + "hidden" + ], + "valueType": "any", + "value": [], + "label": "", + "required": false, + "debugLabel": "", + "toolDescription": "" + }, + { + "key": "system_httpContentType", + "renderTypeList": [ + "hidden" + ], + "valueType": "string", + "value": "json", + "label": "", + "required": false, + "debugLabel": "", + "toolDescription": "" + }, + { + "valueType": "string", + "renderTypeList": [ + "reference" + ], + "key": "query", + "label": "query", + "toolDescription": "博查搜索检索词", + "required": true, + "canEdit": true, + "editField": { + "key": true, + "description": true + }, + "customInputConfig": { + "selectValueTypeList": [ + "string", + "number", + "boolean", + "object", + "arrayString", + "arrayNumber", + "arrayBoolean", + "arrayObject", + "arrayAny", + "any", + "chatHistory", + "datasetQuote", + "dynamic", + "selectApp", + "selectDataset" + ], + "showDescription": false, + "showDefaultValue": true + }, + "value": [ + "pluginInput", + "query" + ] + }, + { + "valueType": "string", + "renderTypeList": [ + "reference" + ], + "key": "freshness", + "label": "freshness", + "toolDescription": "搜索时间范围", + "required": false, + "canEdit": true, + "editField": { + "key": true, + "description": true + }, + "customInputConfig": { + "selectValueTypeList": [ + "string", + "number", + "boolean", + "object", + "arrayString", + "arrayNumber", + "arrayBoolean", + "arrayObject", + "arrayAny", + "any", + "chatHistory", + "datasetQuote", + "dynamic", + "selectApp", + "selectDataset" + ], + "showDescription": false, + "showDefaultValue": true + }, + "value": [ + "pluginInput", + "freshness" + ] + }, + { + "valueType": "boolean", + "renderTypeList": [ + "reference" + ], + "key": "summary", + "label": "summary", + "toolDescription": "是否显示文本摘要", + "required": false, + "canEdit": true, + "editField": { + "key": true, + "description": true + }, + "customInputConfig": { + "selectValueTypeList": [ + "string", + "number", + "boolean", + "object", + "arrayString", + "arrayNumber", + "arrayBoolean", + "arrayObject", + "arrayAny", + "any", + "chatHistory", + "datasetQuote", + "dynamic", + "selectApp", + "selectDataset" + ], + "showDescription": false, + "showDefaultValue": true + }, + "value": [ + "pluginInput", + "summary" + ] + }, + { + "valueType": "string", + "renderTypeList": [ + "reference" + ], + "key": "include", + "label": "include", + "toolDescription": "指定搜索的site范围", + "required": false, + "canEdit": true, + "editField": { + "key": true, + "description": true + }, + "customInputConfig": { + "selectValueTypeList": [ + "string", + "number", + "boolean", + "object", + "arrayString", + "arrayNumber", + "arrayBoolean", + "arrayObject", + "arrayAny", + "any", + "chatHistory", + "datasetQuote", + "dynamic", + "selectApp", + "selectDataset" + ], + "showDescription": false, + "showDefaultValue": true + }, + "value": [ + "pluginInput", + "include" + ] + }, + { + "valueType": "string", + "renderTypeList": [ + "reference" + ], + "key": "exclude", + "label": "exclude", + "toolDescription": "排除搜索的网站范围", + "required": false, + "canEdit": true, + "editField": { + "key": true, + "description": true + }, + "customInputConfig": { + "selectValueTypeList": [ + "string", + "number", + "boolean", + "object", + "arrayString", + "arrayNumber", + "arrayBoolean", + "arrayObject", + "arrayAny", + "any", + "chatHistory", + "datasetQuote", + "dynamic", + "selectApp", + "selectDataset" + ], + "showDescription": false, + "showDefaultValue": true + }, + "value": [ + "pluginInput", + "exclude" + ] + }, + { + "valueType": "number", + "renderTypeList": [ + "reference" + ], + "key": "count", + "label": "count", + "toolDescription": "返回结果条数", + "required": false, + "canEdit": true, + "editField": { + "key": true, + "description": true + }, + "customInputConfig": { + "selectValueTypeList": [ + "string", + "number", + "boolean", + "object", + "arrayString", + "arrayNumber", + "arrayBoolean", + "arrayObject", + "arrayAny", + "any", + "chatHistory", + "datasetQuote", + "dynamic", + "selectApp", + "selectDataset" + ], + "showDescription": false, + "showDefaultValue": true + }, + "value": [ + "pluginInput", + "count" + ] + } + ], + "outputs": [ + { + "id": "error", + "key": "error", + "label": "workflow:request_error", + "description": "HTTP请求错误信息,成功时返回空", + "valueType": "object", + "type": "static" + }, + { + "id": "httpRawResponse", + "key": "httpRawResponse", + "required": true, + "label": "workflow:raw_response", + "description": "HTTP请求的原始响应。只能接受字符串或JSON类型响应数据。", + "valueType": "any", + "type": "static" + }, + { + "id": "system_addOutputParam", + "key": "system_addOutputParam", + "type": "dynamic", + "valueType": "dynamic", + "label": "", + "editField": { + "key": true, + "valueType": true + } + } + ] + } + ], + "edges": [ + { + "source": "pluginInput", + "target": "nyA6oA8mF1iW", + "sourceHandle": "pluginInput-source-right", + "targetHandle": "nyA6oA8mF1iW-target-left" + }, + { + "source": "nyA6oA8mF1iW", + "target": "pluginOutput", + "sourceHandle": "nyA6oA8mF1iW-source-right", + "targetHandle": "pluginOutput-target-left" + } + ] + }, + "chatConfig": {} +} \ No newline at end of file diff --git a/packages/web/components/common/Icon/constants.ts b/packages/web/components/common/Icon/constants.ts index 0866e5012..586420fe6 100644 --- a/packages/web/components/common/Icon/constants.ts +++ b/packages/web/components/common/Icon/constants.ts @@ -287,6 +287,7 @@ export const iconPaths = { 'core/workflow/template/aiChat': () => import('./icons/core/workflow/template/aiChat.svg'), 'core/workflow/template/baseChart': () => import('./icons/core/workflow/template/baseChart.svg'), 'core/workflow/template/bing': () => import('./icons/core/workflow/template/bing.svg'), + 'core/workflow/template/bocha': () => import('./icons/core/workflow/template/bocha.svg'), 'core/workflow/template/codeRun': () => import('./icons/core/workflow/template/codeRun.svg'), 'core/workflow/template/customFeedback': () => import('./icons/core/workflow/template/customFeedback.svg'), diff --git a/packages/web/components/common/Icon/icons/core/workflow/template/bocha.svg b/packages/web/components/common/Icon/icons/core/workflow/template/bocha.svg new file mode 100644 index 000000000..071333021 --- /dev/null +++ b/packages/web/components/common/Icon/icons/core/workflow/template/bocha.svg @@ -0,0 +1,5 @@ + + + + +