|
|
|
@@ -169,12 +169,11 @@ const StepTwo = ({ |
|
|
|
const [rules, setRules] = useState<PreProcessingRule[]>([]) |
|
|
|
const [defaultConfig, setDefaultConfig] = useState<Rules>() |
|
|
|
const hasSetIndexType = !!indexingType |
|
|
|
const [indexType, setIndexType] = useState<IndexingType>( |
|
|
|
(indexingType |
|
|
|
|| isAPIKeySet) |
|
|
|
? IndexingType.QUALIFIED |
|
|
|
: IndexingType.ECONOMICAL, |
|
|
|
) |
|
|
|
const [indexType, setIndexType] = useState<IndexingType>(() => { |
|
|
|
if (hasSetIndexType) |
|
|
|
return indexingType |
|
|
|
return isAPIKeySet ? IndexingType.QUALIFIED : IndexingType.ECONOMICAL |
|
|
|
}) |
|
|
|
|
|
|
|
const [previewFile, setPreviewFile] = useState<DocumentItem>( |
|
|
|
(datasetId && documentDetail) |
|
|
|
@@ -421,6 +420,13 @@ const StepTwo = ({ |
|
|
|
} |
|
|
|
else { // create |
|
|
|
const indexMethod = getIndexing_technique() |
|
|
|
if (indexMethod === IndexingType.QUALIFIED && (!embeddingModel.model || !embeddingModel.provider)) { |
|
|
|
Toast.notify({ |
|
|
|
type: 'error', |
|
|
|
message: t('appDebug.datasetConfig.embeddingModelRequired'), |
|
|
|
}) |
|
|
|
return |
|
|
|
} |
|
|
|
if ( |
|
|
|
!isReRankModelSelected({ |
|
|
|
rerankModelList, |
|
|
|
@@ -568,7 +574,6 @@ const StepTwo = ({ |
|
|
|
// get indexing type by props |
|
|
|
if (indexingType) |
|
|
|
setIndexType(indexingType as IndexingType) |
|
|
|
|
|
|
|
else |
|
|
|
setIndexType(isAPIKeySet ? IndexingType.QUALIFIED : IndexingType.ECONOMICAL) |
|
|
|
}, [isAPIKeySet, indexingType, datasetId]) |
|
|
|
@@ -848,10 +853,9 @@ const StepTwo = ({ |
|
|
|
description={t('datasetCreation.stepTwo.qualifiedTip')} |
|
|
|
icon={<Image src={indexMethodIcon.high_quality} alt='' />} |
|
|
|
isActive={!hasSetIndexType && indexType === IndexingType.QUALIFIED} |
|
|
|
disabled={!isAPIKeySet || hasSetIndexType} |
|
|
|
disabled={hasSetIndexType} |
|
|
|
onSwitched={() => { |
|
|
|
if (isAPIKeySet) |
|
|
|
setIndexType(IndexingType.QUALIFIED) |
|
|
|
setIndexType(IndexingType.QUALIFIED) |
|
|
|
}} |
|
|
|
/> |
|
|
|
)} |
|
|
|
@@ -894,11 +898,10 @@ const StepTwo = ({ |
|
|
|
description={t('datasetCreation.stepTwo.economicalTip')} |
|
|
|
icon={<Image src={indexMethodIcon.economical} alt='' />} |
|
|
|
isActive={!hasSetIndexType && indexType === IndexingType.ECONOMICAL} |
|
|
|
disabled={!isAPIKeySet || hasSetIndexType || docForm !== ChunkingMode.text} |
|
|
|
disabled={hasSetIndexType || docForm !== ChunkingMode.text} |
|
|
|
ref={economyDomRef} |
|
|
|
onSwitched={() => { |
|
|
|
if (isAPIKeySet && docForm === ChunkingMode.text) |
|
|
|
setIndexType(IndexingType.ECONOMICAL) |
|
|
|
setIndexType(IndexingType.ECONOMICAL) |
|
|
|
}} |
|
|
|
/> |
|
|
|
</PortalToFollowElemTrigger> |