From 361e255af81e8cba830e5f2f8dc1b37294dbdcb2 Mon Sep 17 00:00:00 2001 From: archer <545436317@qq.com> Date: Tue, 3 Jun 2025 11:04:17 +0800 Subject: [PATCH] fix: tool call --- packages/plugins/src/bocha/template.json | 1275 ++++++++--------- .../app/detail/Gate/ChatGate.tsx | 3 - .../detail/Gate/components/GateToolSelect.tsx | 1 - .../pageComponents/app/detail/useChatGate.tsx | 16 +- 4 files changed, 615 insertions(+), 680 deletions(-) diff --git a/packages/plugins/src/bocha/template.json b/packages/plugins/src/bocha/template.json index dc84bf4ec..ccf7fcfbd 100644 --- a/packages/plugins/src/bocha/template.json +++ b/packages/plugins/src/bocha/template.json @@ -1,677 +1,604 @@ { - "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 - } - } - ] - } + "author": "", + "name": "网络搜索", + "avatar": "common/searchLight", + "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": "返回结果条数" + } ], - "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" - } + "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" + } ] - }, - "chatConfig": {} -} \ No newline at end of file + }, + { + "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": {} +} diff --git a/projects/app/src/pageComponents/app/detail/Gate/ChatGate.tsx b/projects/app/src/pageComponents/app/detail/Gate/ChatGate.tsx index 56192f6dd..41714ec2d 100644 --- a/projects/app/src/pageComponents/app/detail/Gate/ChatGate.tsx +++ b/projects/app/src/pageComponents/app/detail/Gate/ChatGate.tsx @@ -10,9 +10,6 @@ import { useChatStore } from '@/web/core/chat/context/useChatStore'; import MyBox from '@fastgpt/web/components/common/MyBox'; import { cardStyles } from '../constants'; import ChatQuoteList from '@/pageComponents/chat/ChatQuoteList'; -import { useRequest2 } from '@fastgpt/web/hooks/useRequest'; -import { getQuickApps, listQuickApps } from '@/web/support/user/team/gate/quickApp'; -import Avatar from '@fastgpt/web/components/common/Avatar'; type Props = { appForm: AppSimpleEditFormType; diff --git a/projects/app/src/pageComponents/app/detail/Gate/components/GateToolSelect.tsx b/projects/app/src/pageComponents/app/detail/Gate/components/GateToolSelect.tsx index baa98dfe5..3b0238047 100644 --- a/projects/app/src/pageComponents/app/detail/Gate/components/GateToolSelect.tsx +++ b/projects/app/src/pageComponents/app/detail/Gate/components/GateToolSelect.tsx @@ -47,7 +47,6 @@ const GateToolSelect = ({ const { data: gateConfig, loading: loadingGateConfig } = useRequest2(() => getTeamGateConfig(), { manual: false }); - console.log('gateConfig', gateConfig); // 获取系统插件模板 const { data: systemPlugins = [], loading: loadingSystemPlugins } = useRequest2( diff --git a/projects/app/src/pageComponents/app/detail/useChatGate.tsx b/projects/app/src/pageComponents/app/detail/useChatGate.tsx index aeaf76796..252c94114 100644 --- a/projects/app/src/pageComponents/app/detail/useChatGate.tsx +++ b/projects/app/src/pageComponents/app/detail/useChatGate.tsx @@ -31,6 +31,18 @@ export const useChatGate = ({ const { userInfo } = useUserStore(); const { setChatId, chatId, appId } = useChatStore(); const [selectedTools, setSelectedTools] = useState([]); + const onSelectTools = useCallback( + (tools: FlowNodeTemplateType[]) => { + tools.forEach((tool) => { + const formTool = appForm.selectedTools.find((t) => t.pluginId === tool.pluginId); + if (formTool) { + tool.inputs = formTool.inputs; + } + }); + setSelectedTools(tools); + }, + [appForm] + ); const [workflowData, setWorkflowData] = useSafeState({ nodes: appDetail.modules || [], @@ -153,7 +165,7 @@ export const useChatGate = ({ const { data: recommendApps = [] } = useRequest2(listQuickApps, { manual: false }); - console.log(appForm, 111); + const CustomChatContainer = useMemoizedFn(() => ( ));