chore: refactor tool loading logic to improve shared tool handling

--bug=1060756 --user=刘瑞斌 【应用】AI对话节点的工具,无法获取共享工具 https://www.tapd.cn/62980211/s/1760222
This commit is contained in:
CaptainB 2025-08-22 17:33:30 +08:00
parent 72fd741fbc
commit 925cedec28

View File

@ -196,13 +196,17 @@ function getList() {
const folder_id = currentFolder.value?.id || user.getWorkspaceId()
loadSharedApi({
type: 'tool',
systemType: apiType.value,
isShared: folder_id === 'share',
systemType: 'workspace',
}).getToolList({
folder_id: folder_id,
tool_type: 'CUSTOM'
}).then((res: any) => {
toolList.value = res.data?.tools || res.data || []
toolList.value = toolList.value?.filter((item: any) => item.is_active)
searchData.value = res.data.tools || res.data
searchData.value = searchData.value?.filter((item: any) => item.is_active)
})
.getToolList({ folder_id }, apiLoading)
.then((res: any) => {
toolList.value = uniqueArray([...toolList.value, ...res.data.tools], 'id')
searchData.value = res.data.tools
})
}
defineExpose({ open })