Fix: add check for maximum chunk length (#9837)

This commit is contained in:
KVOJJJin
2024-10-25 15:02:36 +08:00
committed by GitHub
parent 84a9d2d072
commit 7a0d0d9b96
3 changed files with 11 additions and 0 deletions

View File

@@ -212,6 +212,10 @@ const StepTwo = ({
}
const confirmChangeCustomConfig = () => {
if (segmentationType === SegmentType.CUSTOM && max > 4000) {
Toast.notify({ type: 'error', message: t('datasetCreation.stepTwo.maxLengthCheck') })
return
}
setCustomFileIndexingEstimate(null)
setShowPreview()
fetchFileIndexingEstimate()
@@ -339,6 +343,10 @@ const StepTwo = ({
Toast.notify({ type: 'error', message: t('datasetCreation.stepTwo.overlapCheck') })
return
}
if (segmentationType === SegmentType.CUSTOM && max > 4000) {
Toast.notify({ type: 'error', message: t('datasetCreation.stepTwo.maxLengthCheck') })
return
}
if (isSetting) {
params = {
original_document_id: documentDetail?.id,
@@ -663,6 +671,7 @@ const StepTwo = ({
className='h-9'
placeholder={t('datasetCreation.stepTwo.maxLength') || ''}
value={max}
max={4000}
min={1}
onChange={e => setMax(parseInt(e.target.value.replace(/^0+/, ''), 10))}
/>