From b7472c7ab0e45ea65f1137fb45d0f0f2bfa3c8ac Mon Sep 17 00:00:00 2001 From: Joel Date: Fri, 6 Dec 2024 18:28:56 +0800 Subject: [PATCH 1/4] chore: change batch url --- web/service/knowledge/use-document.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/service/knowledge/use-document.ts b/web/service/knowledge/use-document.ts index 5b200d899d..5efc936f41 100644 --- a/web/service/knowledge/use-document.ts +++ b/web/service/knowledge/use-document.ts @@ -35,7 +35,7 @@ const toBatchDocumentsIdParams = (documentIds: string[] | string) => { export const useDocumentBatchAction = (action: DocumentActionType) => { return useMutation({ mutationFn: ({ datasetId, documentIds, documentId }: UpdateDocumentBatchParams) => { - return patch(`/datasets/${datasetId}/documents/status/${action}?${toBatchDocumentsIdParams(documentId || documentIds!)}`) + return patch(`/datasets/${datasetId}/documents/status/${action}/batch?${toBatchDocumentsIdParams(documentId || documentIds!)}`) }, }) } @@ -59,7 +59,7 @@ export const useDocumentUnArchive = () => { export const useDocumentDelete = () => { return useMutation({ mutationFn: ({ datasetId, documentIds, documentId }: UpdateDocumentBatchParams) => { - return del(`/datasets/${datasetId}/documents?${toBatchDocumentsIdParams(documentId || documentIds!)}`) + return del(`/datasets/${datasetId}/documents/batch?${toBatchDocumentsIdParams(documentId || documentIds!)}`) }, }) } From cc2a9cdf378430e54e7bb5a69288044d4426c9b1 Mon Sep 17 00:00:00 2001 From: AkaraChen Date: Fri, 6 Dec 2024 22:33:53 +0800 Subject: [PATCH 2/4] wip: refactor --- web/app/components/datasets/create/step-two/index.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/app/components/datasets/create/step-two/index.tsx b/web/app/components/datasets/create/step-two/index.tsx index 95e2e766df..3e1e9b6eba 100644 --- a/web/app/components/datasets/create/step-two/index.tsx +++ b/web/app/components/datasets/create/step-two/index.tsx @@ -177,6 +177,8 @@ const StepTwo = ({ setDocForm(value) // eslint-disable-next-line @typescript-eslint/no-use-before-define currentEstimateMutation.reset() + if (value === ChuckingMode.parentChild) + setIndexType(IndexingType.QUALIFIED) } const [docLanguage, setDocLanguage] = useState( From ec1c03f0a340875c0cf863a5f85385ce74829ac0 Mon Sep 17 00:00:00 2001 From: AkaraChen Date: Mon, 9 Dec 2024 10:08:19 +0800 Subject: [PATCH 3/4] fix: i18n & option card props --- .../datasets/create/step-two/index.module.css | 4 ++++ .../datasets/create/step-two/index.tsx | 23 +++++++++++++++---- .../datasets/create/step-two/option-card.tsx | 6 ++--- web/i18n/en-US/dataset-creation.ts | 2 ++ web/i18n/zh-Hans/dataset-creation.ts | 2 ++ 5 files changed, 29 insertions(+), 8 deletions(-) diff --git a/web/app/components/datasets/create/step-two/index.module.css b/web/app/components/datasets/create/step-two/index.module.css index 85a7f8ab35..db4c616363 100644 --- a/web/app/components/datasets/create/step-two/index.module.css +++ b/web/app/components/datasets/create/step-two/index.module.css @@ -75,6 +75,10 @@ cursor: pointer; } +.disabled { + cursor: not-allowed; +} + .indexItem.disabled:hover { background-color: #fcfcfd; border-color: #f2f4f7; diff --git a/web/app/components/datasets/create/step-two/index.tsx b/web/app/components/datasets/create/step-two/index.tsx index 3e1e9b6eba..fb2994cd26 100644 --- a/web/app/components/datasets/create/step-two/index.tsx +++ b/web/app/components/datasets/create/step-two/index.tsx @@ -505,6 +505,9 @@ const StepTwo = ({ } const changeToEconomicalType = () => { + if (docForm === ChuckingMode.parentChild) + return + if (!hasSetIndexType) { setIndexType(IndexingType.ECONOMICAL) if (docForm === ChuckingMode.qa) @@ -557,8 +560,12 @@ const StepTwo = ({ icon={{t('datasetCreation.stepTwo.general')}} activeHeaderClassName='bg-gradient-to-r from-[#EFF0F9] to-[#F9FAFB]' description={t('datasetCreation.stepTwo.generalTip')} - isActive={docForm === ChuckingMode.qa || docForm === ChuckingMode.text} - onSelect={() => handleChangeDocform(ChuckingMode.text)} + isActive={ + [ChuckingMode.text, ChuckingMode.qa].includes(docForm) + } + onSwitched={() => + handleChangeDocform(ChuckingMode.text) + } actions={ <>