From 02125c64e5cce3587837ab38f9731e5f2be2d6ce Mon Sep 17 00:00:00 2001
From: wangdan-fit2cloud <79562285+wangdan-fit2cloud@users.noreply.github.com>
Date: Thu, 18 Apr 2024 19:13:31 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E3=80=90=E5=BA=94=E7=94=A8=E3=80=91?=
=?UTF-8?q?=E5=AF=B9=E8=AF=9D=E6=97=A5=E5=BF=97=E4=BF=9D=E5=AD=98=E5=88=B0?=
=?UTF-8?q?=E6=96=87=E6=A1=A3=E4=B8=8B=E6=8B=89=E9=80=89=E9=A1=B9=E6=94=AF?=
=?UTF-8?q?=E6=8C=81=E6=90=9C=E7=B4=A2=20(#123)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* feat: 【应用】对话日志保存至文档选项支持搜索(#123)
* feat: 【应用】对话日志保存到文档下拉选项支持搜索 (#123)
---
.../views/log/component/EditContentDialog.vue | 90 +++++++++++--------
1 file changed, 53 insertions(+), 37 deletions(-)
diff --git a/ui/src/views/log/component/EditContentDialog.vue b/ui/src/views/log/component/EditContentDialog.vue
index 86ad4f95e..a36b4a7eb 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
)