mirror of
https://github.com/langgenius/dify.git
synced 2026-04-25 17:47:30 +08:00
fix: delimiter not support empty and not escape
This commit is contained in:
parent
0006852b5b
commit
ade6dd4b6f
@ -157,8 +157,8 @@ const StepTwo = ({
|
|||||||
const dataSourceType = isInCreatePage ? inCreatePageDataSourceType : currentDataset?.data_source_type
|
const dataSourceType = isInCreatePage ? inCreatePageDataSourceType : currentDataset?.data_source_type
|
||||||
const [segmentationType, setSegmentationType] = useState<SegmentType>(SegmentType.CUSTOM)
|
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, canEmpty?: boolean) => {
|
||||||
doSetSegmentIdentifier(value ? escape(value) : DEFAULT_SEGMENT_IDENTIFIER)
|
doSetSegmentIdentifier(value ? escape(value) : (canEmpty ? '' : DEFAULT_SEGMENT_IDENTIFIER))
|
||||||
}, [])
|
}, [])
|
||||||
const [maxChunkLength, setMaxChunkLength] = useState(DEFAULT_MAXMIMUM_CHUNK_LENGTH) // default chunk length
|
const [maxChunkLength, setMaxChunkLength] = useState(DEFAULT_MAXMIMUM_CHUNK_LENGTH) // default chunk length
|
||||||
const [limitMaxChunkLength, setLimitMaxChunkLength] = useState(4000)
|
const [limitMaxChunkLength, setLimitMaxChunkLength] = useState(4000)
|
||||||
@ -612,7 +612,7 @@ const StepTwo = ({
|
|||||||
<div className='flex gap-3'>
|
<div className='flex gap-3'>
|
||||||
<DelimiterInput
|
<DelimiterInput
|
||||||
value={segmentIdentifier}
|
value={segmentIdentifier}
|
||||||
onChange={e => setSegmentIdentifier(e.target.value)}
|
onChange={e => setSegmentIdentifier(e.target.value, true)}
|
||||||
/>
|
/>
|
||||||
<MaxLengthInput
|
<MaxLengthInput
|
||||||
value={maxChunkLength}
|
value={maxChunkLength}
|
||||||
@ -737,7 +737,7 @@ const StepTwo = ({
|
|||||||
...parentChildConfig,
|
...parentChildConfig,
|
||||||
parent: {
|
parent: {
|
||||||
...parentChildConfig.parent,
|
...parentChildConfig.parent,
|
||||||
delimiter: e.target.value,
|
delimiter: e.target.value ? escape(e.target.value) : '',
|
||||||
},
|
},
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
@ -782,7 +782,7 @@ const StepTwo = ({
|
|||||||
...parentChildConfig,
|
...parentChildConfig,
|
||||||
child: {
|
child: {
|
||||||
...parentChildConfig.child,
|
...parentChildConfig.child,
|
||||||
delimiter: e.target.value,
|
delimiter: e.target.value ? escape(e.target.value) : '',
|
||||||
},
|
},
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user