wip: create datasets

pull/12097/head
AkaraChen 1 year ago
parent a893309b73
commit 6e38b523c9

@ -148,7 +148,7 @@ const StepTwo = ({
const { dataset: currentDataset, mutateDatasetRes } = useDatasetDetailContext() const { dataset: currentDataset, mutateDatasetRes } = useDatasetDetailContext()
const isInCreatePage = !datasetId || (datasetId && !currentDataset?.data_source_type) const isInCreatePage = !datasetId || (datasetId && !currentDataset?.data_source_type)
const dataSourceType = isInCreatePage ? inCreatePageDataSourceType : currentDataset?.data_source_type const dataSourceType = isInCreatePage ? inCreatePageDataSourceType : currentDataset?.data_source_type
const [segmentationType, setSegmentationType] = useState<SegmentType>(SegmentType.AUTO) const [segmentationType, setSegmentationType] = useState<SegmentType>(SegmentType.CUSTOM)
const [segmentIdentifier, doSetSegmentIdentifier] = useState(DEFAULT_SEGMENT_IDENTIFIER) const [segmentIdentifier, doSetSegmentIdentifier] = useState(DEFAULT_SEGMENT_IDENTIFIER)
const setSegmentIdentifier = useCallback((value: string) => { const setSegmentIdentifier = useCallback((value: string) => {
doSetSegmentIdentifier(value ? escape(value) : DEFAULT_SEGMENT_IDENTIFIER) doSetSegmentIdentifier(value ? escape(value) : DEFAULT_SEGMENT_IDENTIFIER)
@ -180,13 +180,16 @@ const StepTwo = ({
const getIndexing_technique = () => indexingType || indexType const getIndexing_technique = () => indexingType || indexType
const getProcessRule = () => { const getProcessRule = (): ProcessRule => {
if (docForm === ChuckingMode.parentChild) {
return { return {
rules: { rules: {
pre_processing_rules: rules, pre_processing_rules: rules,
segmentation: { segmentation: {
separator: unescape(segmentIdentifier), separator: unescape(
max_tokens: maxChunkLength, parentChildConfig.parent.delimiter,
),
max_tokens: parentChildConfig.parent.maxLength,
chunk_overlap: overlap, chunk_overlap: overlap,
}, },
parent_mode: parentChildConfig.chunkForContext, parent_mode: parentChildConfig.chunkForContext,
@ -195,9 +198,19 @@ const StepTwo = ({
max_tokens: parentChildConfig.child.maxLength, max_tokens: parentChildConfig.child.maxLength,
}, },
}, // api will check this. It will be removed after api refactored. }, // api will check this. It will be removed after api refactored.
mode: docForm === ChuckingMode.parentChild mode: 'hierarchical',
? 'hierarchical' } as ProcessRule
: segmentationType, }
return {
rules: {
pre_processing_rules: rules,
segmentation: {
separator: unescape(segmentIdentifier),
max_tokens: maxChunkLength,
chunk_overlap: overlap,
},
}, // api will check this. It will be removed after api refactored.
mode: segmentationType,
} as ProcessRule } as ProcessRule
} }

Loading…
Cancel
Save