Skip to content

Commit 3627d8a

Browse files
authored
fix: The data source Tree uses fetc_list_function (#4440)
1 parent 44326c3 commit 3627d8a

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

ui/src/components/dynamics-form/items/tree/Tree.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,13 @@ function renderTemplate(template: string, data: any) {
168168
}
169169
170170
const loadNode = (node: Node, resolve: (nodeData: Tree[]) => void) => {
171+
const get_extra = inject('get_extra') as any
171172
request_call(request, {
172-
url: renderTemplate(attrs.url, props.otherParams),
173+
url: renderTemplate(
174+
'/workspace/${current_workspace_id}/knowledge/${current_knowledge_id}/datasource/tool/${current_tool_id}/' +
175+
attrs.fetch_list_function,
176+
{ ...props.otherParams, ...(get_extra ? get_extra() : {}) },
177+
),
173178
body: { current_node: node.level == 0 ? undefined : node.data },
174179
then: (res: any) => {
175180
resolve(res.data)

ui/src/views/knowledge-workflow/component/action/DataSource.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
</DynamicsForm>
4444
</template>
4545
<script setup lang="ts">
46-
import { computed, ref, watch } from 'vue'
46+
import { computed, ref, watch, provide } from 'vue'
4747
import { WorkflowKind, WorkflowType } from '@/enums/application'
4848
import DynamicsForm from '@/components/dynamics-form/index.vue'
4949
import type { FormField } from '@/components/dynamics-form/type'
@@ -100,9 +100,18 @@ const form_data = computed({
100100
const source_node_list = computed(() => {
101101
return props.workflow?.nodes?.filter((n: any) => n.properties.kind === WorkflowKind.DataSource)
102102
})
103+
const extra = ref<any>({
104+
current_tool_id: undefined,
105+
})
106+
const get_extra = () => {
107+
return extra.value
108+
}
109+
provide('get_extra', get_extra)
110+
103111
const sourceChange = (node_id: string) => {
104112
base_form_data.value.node_id = node_id
105113
const n = source_node_list.value.find((n: any) => n.id == node_id)
114+
extra.value.current_tool_id = n.properties.node_data.tool_lib_id
106115
node_id = n
107116
? [WorkflowType.DataSourceLocalNode, WorkflowType.DataSourceWebNode].includes(n.type)
108117
? n.type

0 commit comments

Comments
 (0)