fix: Update segmentation type initialization to support parent-child mode based on document form (#21359)
This commit is contained in:
parent
f2f6e95880
commit
b348455144
1 changed files with 6 additions and 4 deletions
|
|
@ -161,7 +161,9 @@ const StepTwo = ({
|
||||||
|
|
||||||
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<ProcessMode>(ProcessMode.general)
|
const [segmentationType, setSegmentationType] = useState<ProcessMode>(
|
||||||
|
currentDataset?.doc_form === ChunkingMode.parentChild ? ProcessMode.parentChild : ProcessMode.general,
|
||||||
|
)
|
||||||
const [segmentIdentifier, doSetSegmentIdentifier] = useState(DEFAULT_SEGMENT_IDENTIFIER)
|
const [segmentIdentifier, doSetSegmentIdentifier] = useState(DEFAULT_SEGMENT_IDENTIFIER)
|
||||||
const setSegmentIdentifier = useCallback((value: string, canEmpty?: boolean) => {
|
const setSegmentIdentifier = useCallback((value: string, canEmpty?: boolean) => {
|
||||||
doSetSegmentIdentifier(value ? escape(value) : (canEmpty ? '' : DEFAULT_SEGMENT_IDENTIFIER))
|
doSetSegmentIdentifier(value ? escape(value) : (canEmpty ? '' : DEFAULT_SEGMENT_IDENTIFIER))
|
||||||
|
|
@ -1137,7 +1139,7 @@ const StepTwo = ({
|
||||||
const indexForLabel = index + 1
|
const indexForLabel = index + 1
|
||||||
return (
|
return (
|
||||||
<PreviewSlice
|
<PreviewSlice
|
||||||
key={child}
|
key={`C-${indexForLabel}-${child}`}
|
||||||
label={`C-${indexForLabel}`}
|
label={`C-${indexForLabel}`}
|
||||||
text={child}
|
text={child}
|
||||||
tooltip={`Child-chunk-${indexForLabel} · ${child.length} Characters`}
|
tooltip={`Child-chunk-${indexForLabel} · ${child.length} Characters`}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue