diff --git a/ui/src/views/log/component/EditContentDialog.vue b/ui/src/views/log/component/EditContentDialog.vue
index 86ad4f95ea8..a36b4a7ebab 100644
--- a/ui/src/views/log/component/EditContentDialog.vue
+++ b/ui/src/views/log/component/EditContentDialog.vue
@@ -26,17 +26,18 @@
-
-
+
-
+
- {{ data.name }}
+ {{ item.name }}
-
-
+
+
+
+
+
+
+ {{ item.name }}
+
+
@@ -70,7 +88,6 @@ import { ref, watch, reactive } from 'vue'
import { useRoute } from 'vue-router'
import type { FormInstance, FormRules } from 'element-plus'
import logApi from '@/api/log'
-import type { CascaderProps } from 'element-plus'
import useStore from '@/stores'
const { application, document } = useStore()
@@ -99,15 +116,19 @@ const form = ref({
problem_text: '',
title: '',
content: '',
- document: []
+ dataset_id: '',
+ document_id: ''
})
const rules = reactive({
content: [{ required: true, message: '请输入内容', trigger: 'blur' }],
- document: [{ type: 'array', required: true, message: '请选择文档', trigger: 'change' }]
+ dataset_id: [{ required: true, message: '请选择知识库', trigger: 'change' }],
+ document_id: [{ required: true, message: '请选择文档', trigger: 'change' }]
})
-const datasetList = ref([])
+const datasetList = ref([])
+const documentList = ref([])
+const optionLoading = ref(false)
watch(dialogVisible, (bool) => {
if (!bool) {
@@ -117,45 +138,40 @@ watch(dialogVisible, (bool) => {
problem_text: '',
title: '',
content: '',
- document: []
+ dataset_id: '',
+ document_id: ''
}
+ datasetList.value = []
+ documentList.value = []
+ formRef.value?.clearValidate()
}
})
-const LoadDocument: CascaderProps = {
- lazy: true,
- value: 'id',
- label: 'name',
- leaf: 'dataset_id',
- lazyLoad(node, resolve: any) {
- const { level, data } = node
- if (data?.id) {
- getDocument(data?.id as string, resolve)
- } else {
- getDataset(resolve)
- }
- }
+
+function changeDataset(id: string) {
+ form.value.document_id = ''
+ getDocument(id)
}
-function getDocument(id: string, resolve: any) {
+function getDocument(id: string) {
document.asyncGetAllDocument(id, loading).then((res: any) => {
- datasetList.value = res.data
- resolve(datasetList.value)
+ documentList.value = res.data
})
}
-function getDataset(resolve: any) {
+function getDataset() {
application.asyncGetApplicationDataset(id, loading).then((res: any) => {
datasetList.value = res.data
- resolve(datasetList.value)
})
}
const open = (data: any) => {
+ getDataset()
form.value.chat_id = data.chat_id
form.value.record_id = data.id
form.value.problem_text = data.problem_text
form.value.content = data.answer_text
+ formRef.value?.clearValidate()
dialogVisible.value = true
}
const submitForm = async (formEl: FormInstance | undefined) => {
@@ -171,8 +187,8 @@ const submitForm = async (formEl: FormInstance | undefined) => {
id,
form.value.chat_id,
form.value.record_id,
- form.value.document[0],
- form.value.document[1],
+ form.value.dataset_id,
+ form.value.document_id,
obj,
loading
)