fix: tool call

This commit is contained in:
archer 2025-06-03 11:04:17 +08:00
parent 2b888fb0fa
commit 361e255af8
No known key found for this signature in database
GPG Key ID: 4446499B846D4A9E
4 changed files with 615 additions and 680 deletions

View File

@ -1,7 +1,7 @@
{ {
"author": "", "author": "",
"name": "博查搜索", "name": "网络搜索",
"avatar": "core/workflow/template/bocha", "avatar": "common/searchLight",
"intro": "使用博查AI搜索引擎进行网络搜索。", "intro": "使用博查AI搜索引擎进行网络搜索。",
"showStatus": true, "showStatus": true,
"weight": 10, "weight": 10,
@ -24,9 +24,7 @@
"version": "481", "version": "481",
"inputs": [ "inputs": [
{ {
"renderTypeList": [ "renderTypeList": ["input"],
"input"
],
"selectedTypeIndex": 0, "selectedTypeIndex": 0,
"valueType": "string", "valueType": "string",
"canEdit": true, "canEdit": true,
@ -37,10 +35,7 @@
"required": true "required": true
}, },
{ {
"renderTypeList": [ "renderTypeList": ["input", "reference"],
"input",
"reference"
],
"selectedTypeIndex": 0, "selectedTypeIndex": 0,
"valueType": "string", "valueType": "string",
"canEdit": true, "canEdit": true,
@ -52,10 +47,7 @@
"toolDescription": "搜索查询词" "toolDescription": "搜索查询词"
}, },
{ {
"renderTypeList": [ "renderTypeList": ["input", "reference"],
"input",
"reference"
],
"selectedTypeIndex": 0, "selectedTypeIndex": 0,
"valueType": "string", "valueType": "string",
"canEdit": true, "canEdit": true,
@ -67,10 +59,7 @@
"toolDescription": "搜索时间范围" "toolDescription": "搜索时间范围"
}, },
{ {
"renderTypeList": [ "renderTypeList": ["input", "reference"],
"input",
"reference"
],
"selectedTypeIndex": 0, "selectedTypeIndex": 0,
"valueType": "boolean", "valueType": "boolean",
"canEdit": true, "canEdit": true,
@ -82,10 +71,7 @@
"toolDescription": "是否显示文本摘要" "toolDescription": "是否显示文本摘要"
}, },
{ {
"renderTypeList": [ "renderTypeList": ["input", "reference"],
"input",
"reference"
],
"selectedTypeIndex": 0, "selectedTypeIndex": 0,
"valueType": "string", "valueType": "string",
"canEdit": true, "canEdit": true,
@ -97,10 +83,7 @@
"toolDescription": "指定搜索的site范围" "toolDescription": "指定搜索的site范围"
}, },
{ {
"renderTypeList": [ "renderTypeList": ["input", "reference"],
"input",
"reference"
],
"selectedTypeIndex": 0, "selectedTypeIndex": 0,
"valueType": "string", "valueType": "string",
"canEdit": true, "canEdit": true,
@ -112,10 +95,7 @@
"toolDescription": "排除搜索的网站范围" "toolDescription": "排除搜索的网站范围"
}, },
{ {
"renderTypeList": [ "renderTypeList": ["input", "reference"],
"input",
"reference"
],
"selectedTypeIndex": 0, "selectedTypeIndex": 0,
"valueType": "number", "valueType": "number",
"canEdit": true, "canEdit": true,
@ -195,19 +175,14 @@
"version": "481", "version": "481",
"inputs": [ "inputs": [
{ {
"renderTypeList": [ "renderTypeList": ["reference"],
"reference"
],
"valueType": "object", "valueType": "object",
"canEdit": true, "canEdit": true,
"key": "result", "key": "result",
"label": "result", "label": "result",
"isToolOutput": true, "isToolOutput": true,
"description": "", "description": "",
"value": [ "value": ["nyA6oA8mF1iW", "httpRawResponse"]
"nyA6oA8mF1iW",
"httpRawResponse"
]
} }
], ],
"outputs": [] "outputs": []
@ -241,9 +216,7 @@
"inputs": [ "inputs": [
{ {
"key": "system_addInputParam", "key": "system_addInputParam",
"renderTypeList": [ "renderTypeList": ["addInputParam"],
"addInputParam"
],
"valueType": "dynamic", "valueType": "dynamic",
"label": "", "label": "",
"required": false, "required": false,
@ -274,9 +247,7 @@
}, },
{ {
"key": "system_httpMethod", "key": "system_httpMethod",
"renderTypeList": [ "renderTypeList": ["custom"],
"custom"
],
"valueType": "string", "valueType": "string",
"label": "", "label": "",
"value": "POST", "value": "POST",
@ -286,9 +257,7 @@
}, },
{ {
"key": "system_httpTimeout", "key": "system_httpTimeout",
"renderTypeList": [ "renderTypeList": ["custom"],
"custom"
],
"valueType": "number", "valueType": "number",
"label": "", "label": "",
"value": 30, "value": 30,
@ -300,9 +269,7 @@
}, },
{ {
"key": "system_httpReqUrl", "key": "system_httpReqUrl",
"renderTypeList": [ "renderTypeList": ["hidden"],
"hidden"
],
"valueType": "string", "valueType": "string",
"label": "", "label": "",
"description": "common:core.module.input.description.Http Request Url", "description": "common:core.module.input.description.Http Request Url",
@ -314,9 +281,7 @@
}, },
{ {
"key": "system_httpHeader", "key": "system_httpHeader",
"renderTypeList": [ "renderTypeList": ["custom"],
"custom"
],
"valueType": "any", "valueType": "any",
"value": [ "value": [
{ {
@ -339,9 +304,7 @@
}, },
{ {
"key": "system_httpParams", "key": "system_httpParams",
"renderTypeList": [ "renderTypeList": ["hidden"],
"hidden"
],
"valueType": "any", "valueType": "any",
"value": [], "value": [],
"label": "", "label": "",
@ -351,9 +314,7 @@
}, },
{ {
"key": "system_httpJsonBody", "key": "system_httpJsonBody",
"renderTypeList": [ "renderTypeList": ["hidden"],
"hidden"
],
"valueType": "any", "valueType": "any",
"value": "{\n \"query\": \"{{query}}\",\n \"freshness\": \"{{freshness}}\",\n \"summary\": {{summary}},\n \"include\": \"{{include}}\",\n \"exclude\": \"{{exclude}}\",\n \"count\": {{count}}\n}", "value": "{\n \"query\": \"{{query}}\",\n \"freshness\": \"{{freshness}}\",\n \"summary\": {{summary}},\n \"include\": \"{{include}}\",\n \"exclude\": \"{{exclude}}\",\n \"count\": {{count}}\n}",
"label": "", "label": "",
@ -363,9 +324,7 @@
}, },
{ {
"key": "system_httpFormBody", "key": "system_httpFormBody",
"renderTypeList": [ "renderTypeList": ["hidden"],
"hidden"
],
"valueType": "any", "valueType": "any",
"value": [], "value": [],
"label": "", "label": "",
@ -375,9 +334,7 @@
}, },
{ {
"key": "system_httpContentType", "key": "system_httpContentType",
"renderTypeList": [ "renderTypeList": ["hidden"],
"hidden"
],
"valueType": "string", "valueType": "string",
"value": "json", "value": "json",
"label": "", "label": "",
@ -387,9 +344,7 @@
}, },
{ {
"valueType": "string", "valueType": "string",
"renderTypeList": [ "renderTypeList": ["reference"],
"reference"
],
"key": "query", "key": "query",
"label": "query", "label": "query",
"toolDescription": "博查搜索检索词", "toolDescription": "博查搜索检索词",
@ -420,16 +375,11 @@
"showDescription": false, "showDescription": false,
"showDefaultValue": true "showDefaultValue": true
}, },
"value": [ "value": ["pluginInput", "query"]
"pluginInput",
"query"
]
}, },
{ {
"valueType": "string", "valueType": "string",
"renderTypeList": [ "renderTypeList": ["reference"],
"reference"
],
"key": "freshness", "key": "freshness",
"label": "freshness", "label": "freshness",
"toolDescription": "搜索时间范围", "toolDescription": "搜索时间范围",
@ -460,16 +410,11 @@
"showDescription": false, "showDescription": false,
"showDefaultValue": true "showDefaultValue": true
}, },
"value": [ "value": ["pluginInput", "freshness"]
"pluginInput",
"freshness"
]
}, },
{ {
"valueType": "boolean", "valueType": "boolean",
"renderTypeList": [ "renderTypeList": ["reference"],
"reference"
],
"key": "summary", "key": "summary",
"label": "summary", "label": "summary",
"toolDescription": "是否显示文本摘要", "toolDescription": "是否显示文本摘要",
@ -500,16 +445,11 @@
"showDescription": false, "showDescription": false,
"showDefaultValue": true "showDefaultValue": true
}, },
"value": [ "value": ["pluginInput", "summary"]
"pluginInput",
"summary"
]
}, },
{ {
"valueType": "string", "valueType": "string",
"renderTypeList": [ "renderTypeList": ["reference"],
"reference"
],
"key": "include", "key": "include",
"label": "include", "label": "include",
"toolDescription": "指定搜索的site范围", "toolDescription": "指定搜索的site范围",
@ -540,16 +480,11 @@
"showDescription": false, "showDescription": false,
"showDefaultValue": true "showDefaultValue": true
}, },
"value": [ "value": ["pluginInput", "include"]
"pluginInput",
"include"
]
}, },
{ {
"valueType": "string", "valueType": "string",
"renderTypeList": [ "renderTypeList": ["reference"],
"reference"
],
"key": "exclude", "key": "exclude",
"label": "exclude", "label": "exclude",
"toolDescription": "排除搜索的网站范围", "toolDescription": "排除搜索的网站范围",
@ -580,16 +515,11 @@
"showDescription": false, "showDescription": false,
"showDefaultValue": true "showDefaultValue": true
}, },
"value": [ "value": ["pluginInput", "exclude"]
"pluginInput",
"exclude"
]
}, },
{ {
"valueType": "number", "valueType": "number",
"renderTypeList": [ "renderTypeList": ["reference"],
"reference"
],
"key": "count", "key": "count",
"label": "count", "label": "count",
"toolDescription": "返回结果条数", "toolDescription": "返回结果条数",
@ -620,10 +550,7 @@
"showDescription": false, "showDescription": false,
"showDefaultValue": true "showDefaultValue": true
}, },
"value": [ "value": ["pluginInput", "count"]
"pluginInput",
"count"
]
} }
], ],
"outputs": [ "outputs": [

View File

@ -10,9 +10,6 @@ import { useChatStore } from '@/web/core/chat/context/useChatStore';
import MyBox from '@fastgpt/web/components/common/MyBox'; import MyBox from '@fastgpt/web/components/common/MyBox';
import { cardStyles } from '../constants'; import { cardStyles } from '../constants';
import ChatQuoteList from '@/pageComponents/chat/ChatQuoteList'; 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 = { type Props = {
appForm: AppSimpleEditFormType; appForm: AppSimpleEditFormType;

View File

@ -47,7 +47,6 @@ const GateToolSelect = ({
const { data: gateConfig, loading: loadingGateConfig } = useRequest2(() => getTeamGateConfig(), { const { data: gateConfig, loading: loadingGateConfig } = useRequest2(() => getTeamGateConfig(), {
manual: false manual: false
}); });
console.log('gateConfig', gateConfig);
// 获取系统插件模板 // 获取系统插件模板
const { data: systemPlugins = [], loading: loadingSystemPlugins } = useRequest2( const { data: systemPlugins = [], loading: loadingSystemPlugins } = useRequest2(

View File

@ -31,6 +31,18 @@ export const useChatGate = ({
const { userInfo } = useUserStore(); const { userInfo } = useUserStore();
const { setChatId, chatId, appId } = useChatStore(); const { setChatId, chatId, appId } = useChatStore();
const [selectedTools, setSelectedTools] = useState<FlowNodeTemplateType[]>([]); const [selectedTools, setSelectedTools] = useState<FlowNodeTemplateType[]>([]);
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({ const [workflowData, setWorkflowData] = useSafeState({
nodes: appDetail.modules || [], nodes: appDetail.modules || [],
@ -153,7 +165,7 @@ export const useChatGate = ({
const { data: recommendApps = [] } = useRequest2(listQuickApps, { const { data: recommendApps = [] } = useRequest2(listQuickApps, {
manual: false manual: false
}); });
console.log(appForm, 111);
const CustomChatContainer = useMemoizedFn(() => ( const CustomChatContainer = useMemoizedFn(() => (
<ChatBox <ChatBox
isReady={isReady} isReady={isReady}
@ -163,7 +175,7 @@ export const useChatGate = ({
chatType={'chat'} chatType={'chat'}
onStartChat={startChat} onStartChat={startChat}
selectedTools={selectedTools} selectedTools={selectedTools}
onSelectTools={setSelectedTools} onSelectTools={onSelectTools}
recommendApps={recommendApps} recommendApps={recommendApps}
/> />
)); ));