Commit 5cd86f2f authored by nick zheng's avatar nick zheng

Merge branch 'beta' into 'master'

fix: 重新训练点击无反应及限制最多上传五份文件

See merge request !13
parents 630a9df3 3404f8e7
...@@ -115,6 +115,9 @@ export function createKnowledgeDocumentColumn( ...@@ -115,6 +115,9 @@ export function createKnowledgeDocumentColumn(
{ {
type: 'selection', type: 'selection',
fixed: 'left', fixed: 'left',
disabled(row: KnowledgeDocumentItem) {
return !['Complete', 'Fail'].includes(row.trainStatus)
},
}, },
{ {
title: () => <span>{t('personal_space_module.knowledge_module.knowledge_document_name')}</span>, title: () => <span>{t('personal_space_module.knowledge_module.knowledge_document_name')}</span>,
...@@ -235,7 +238,7 @@ export function createKnowledgeDocumentColumn( ...@@ -235,7 +238,7 @@ export function createKnowledgeDocumentColumn(
trigger: () => ( trigger: () => (
<span <span
class={[ class={[
row.trainStatus === 'Complete' ['Complete', 'Fail'].includes(row.trainStatus)
? 'text-error-font-color mr-5 cursor-pointer hover:opacity-80' ? 'text-error-font-color mr-5 cursor-pointer hover:opacity-80'
: 'text-gray-font-color pointer-events-none mr-5 cursor-not-allowed', : 'text-gray-font-color pointer-events-none mr-5 cursor-not-allowed',
]} ]}
......
...@@ -11,6 +11,7 @@ import { ...@@ -11,6 +11,7 @@ import {
fetchDelKnowledgeDocument, fetchDelKnowledgeDocument,
fetchGetKnowledgeDetail, fetchGetKnowledgeDetail,
fetchGetKnowledgeDocumentList, fetchGetKnowledgeDocumentList,
fetchTrainKnowledge,
fetchUpdateKnowledgeInfo, fetchUpdateKnowledgeInfo,
} from '@/apis/knowledge' } from '@/apis/knowledge'
import useTableScrollY from '@/composables/useTableScrollY' import useTableScrollY from '@/composables/useTableScrollY'
...@@ -125,6 +126,8 @@ function handleClickKnowledgeDocumentTableAction(actionType: string, knowledgeDo ...@@ -125,6 +126,8 @@ function handleClickKnowledgeDocumentTableAction(actionType: string, knowledgeDo
case 'delete': case 'delete':
handleDeleteKnowledgeDocument(knowledgeDocumentItem.kdId) handleDeleteKnowledgeDocument(knowledgeDocumentItem.kdId)
break break
case 'train':
handleTrainKnowledgeDocument(knowledgeDocumentItem)
} }
} }
...@@ -144,6 +147,16 @@ async function handleDeleteKnowledgeDocument(kdId: number) { ...@@ -144,6 +147,16 @@ async function handleDeleteKnowledgeDocument(kdId: number) {
} }
} }
async function handleTrainKnowledgeDocument(knowledgeDocumentItem: KnowledgeDocumentItem) {
await fetchTrainKnowledge({
knowledgeInfoId: currentKnowledgeId.value,
kdIds: [knowledgeDocumentItem.kdId],
segmentationConfig: knowledgeDocumentItem.segmentationConfig,
})
await handleGetKnowledgeDocumentList()
}
function handleShowEditKnowledgeModal() { function handleShowEditKnowledgeModal() {
isShowEditKnowledgeModal.value = true isShowEditKnowledgeModal.value = true
} }
......
...@@ -113,7 +113,8 @@ async function handleUpload(file: any) { ...@@ -113,7 +113,8 @@ async function handleUpload(file: any) {
kdId: 0, kdId: 0,
} }
uploadFileList.value.push(fileData) if (uploadFileList.value.length < 5) {
await uploadFileList.value.push(fileData)
fetchUploadKnowledgeDocument<{ kdId: number }[]>(formData) fetchUploadKnowledgeDocument<{ kdId: number }[]>(formData)
.then((res) => { .then((res) => {
...@@ -133,6 +134,7 @@ async function handleUpload(file: any) { ...@@ -133,6 +134,7 @@ async function handleUpload(file: any) {
} }
}) })
}) })
}
} }
function handleRemoveFile(id: string) { function handleRemoveFile(id: string) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment