diff --git a/ui/src/views/log/component/EditContentDialog.vue b/ui/src/views/log/component/EditContentDialog.vue index d97316cd9..c92905441 100644 --- a/ui/src/views/log/component/EditContentDialog.vue +++ b/ui/src/views/log/component/EditContentDialog.vue @@ -216,33 +216,36 @@ const onUploadImg = async (files: any, callback: any) => { callback(res.map((item) => item.data)) } -function changeDataset(id: string) { - if (user.userInfo) { - localStorage.setItem(user.userInfo.id + 'chat_dataset_id', id) - } +function changeDataset(dataset_id: string) { + localStorage.setItem(id + 'chat_dataset_id', dataset_id) form.value.document_id = '' - getDocument(id) + getDocument(dataset_id) } -function changeDocument(id: string) { - if (user.userInfo) { - localStorage.setItem(user.userInfo.id + 'chat_document_id', id) - } +function changeDocument(document_id: string) { + localStorage.setItem(id + 'chat_document_id', document_id) } -function getDocument(id: string) { - document.asyncGetAllDocument(id, loading).then((res: any) => { +function getDocument(dataset_id: string) { + document.asyncGetAllDocument(dataset_id, loading).then((res: any) => { documentList.value = res.data + if (localStorage.getItem(id + 'chat_document_id')) { + form.value.document_id = localStorage.getItem(id + 'chat_document_id') as string + } + if (!documentList.value.find((v) => v.id === form.value.document_id)) { + form.value.document_id = '' + } }) } function getDataset() { application.asyncGetApplicationDataset(id, loading).then((res: any) => { datasetList.value = res.data - if (localStorage.getItem(user.userInfo?.id + 'chat_dataset_id')) { - form.value.dataset_id = localStorage.getItem(user.userInfo?.id + 'chat_dataset_id') as string + if (localStorage.getItem(id + 'chat_dataset_id')) { + form.value.dataset_id = localStorage.getItem(id + 'chat_dataset_id') as string if (!datasetList.value.find((v) => v.id === form.value.dataset_id)) { form.value.dataset_id = '' + form.value.document_id = '' } else { getDocument(form.value.dataset_id) } @@ -252,9 +255,6 @@ function getDataset() { const open = (data: any) => { getDataset() - if (localStorage.getItem(user.userInfo?.id + 'chat_document_id')) { - form.value.document_id = localStorage.getItem(user.userInfo?.id + 'chat_document_id') as string - } form.value.chat_id = data.chat_id form.value.record_id = data.id form.value.problem_text = data.problem_text ? data.problem_text.substring(0, 256) : '' diff --git a/ui/src/views/log/index.vue b/ui/src/views/log/index.vue index eb1b0c3aa..bdf5af51e 100644 --- a/ui/src/views/log/index.vue +++ b/ui/src/views/log/index.vue @@ -33,8 +33,8 @@ 清除策略 导出 添加至知识库 + >添加至知识库 + @@ -171,9 +171,9 @@ 天之前的对话记录