-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Expand file tree
/
Copy pathKnowledgeBase.vue
More file actions
46 lines (45 loc) · 1.33 KB
/
KnowledgeBase.vue
File metadata and controls
46 lines (45 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<template>
<DynamicsForm
v-loading="loading"
v-model="form_data"
:render_data="base_form_list"
:model="form_data"
ref="dynamicsFormRef"
label-position="top"
require-asterisk-position="right"
>
<template #default>
<h4 class="title-decoration-1 mb-16 mt-4">
{{ chat_title || $t('chat.userInput') }}
</h4>
</template>
</DynamicsForm>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue'
import DynamicsForm from '@/components/dynamics-form/index.vue'
import { WorkflowType } from '@/enums/application'
const props = defineProps<{ workflow: any }>()
const loading = ref<boolean>()
const form_data = ref<any>({})
const dynamicsFormRef = ref<InstanceType<typeof DynamicsForm>>()
const validate = () => {
return dynamicsFormRef.value?.validate()
}
const chat_title = computed(() => {
const kBase = props.workflow?.nodes?.find((n: any) => n.type === WorkflowType.KnowledgeBase)
return kBase.properties.user_input_config.title
})
const base_form_list = computed(() => {
const kBase = props.workflow?.nodes?.find((n: any) => n.type === WorkflowType.KnowledgeBase)
if (kBase) {
return kBase.properties.user_input_field_list
}
return []
})
const get_data = () => {
return form_data.value
}
defineExpose({ validate, get_data })
</script>
<style lang="scss" scoped></style>