From e58e573f3e62f90a7a2246e02a5ded849e412d1b Mon Sep 17 00:00:00 2001 From: Wu Tianwei <30284043+WTW0313@users.noreply.github.com> Date: Thu, 2 Jan 2025 18:36:49 +0800 Subject: [PATCH] fix: add full doc mode preview length limit (#12310) ok --- web/app/components/datasets/create/step-two/index.tsx | 7 +++++-- web/config/index.ts | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/web/app/components/datasets/create/step-two/index.tsx b/web/app/components/datasets/create/step-two/index.tsx index c0e6a0f1d3..8353467bec 100644 --- a/web/app/components/datasets/create/step-two/index.tsx +++ b/web/app/components/datasets/create/step-two/index.tsx @@ -53,7 +53,7 @@ import type { DefaultModel } from '@/app/components/header/account-setting/model import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' import Checkbox from '@/app/components/base/checkbox' import RadioCard from '@/app/components/base/radio-card' -import { IS_CE_EDITION } from '@/config' +import { FULL_DOC_PREVIEW_LENGTH, IS_CE_EDITION } from '@/config' import Divider from '@/app/components/base/divider' import { getNotionInfo, getWebsiteInfo, useCreateDocument, useCreateFirstDocument, useFetchDefaultProcessRule, useFetchFileIndexingEstimateForFile, useFetchFileIndexingEstimateForNotion, useFetchFileIndexingEstimateForWeb } from '@/service/knowledge/use-create-dataset' import Badge from '@/app/components/base/badge' @@ -1105,6 +1105,9 @@ const StepTwo = ({ {currentDocForm === ChunkingMode.parentChild && currentEstimateMutation.data?.preview && ( estimate?.preview?.map((item, index) => { const indexForLabel = index + 1 + const childChunks = parentChildConfig.chunkForContext === 'full-doc' + ? item.child_chunks.slice(0, FULL_DOC_PREVIEW_LENGTH) + : item.child_chunks return ( - {item.child_chunks.map((child, index) => { + {childChunks.map((child, index) => { const indexForLabel = index + 1 return (