Skip to content

Commit e58e573

Browse files
authored
fix: add full doc mode preview length limit (#12310)
ok
1 parent 375aa38 commit e58e573

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

web/app/components/datasets/create/step-two/index.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import type { DefaultModel } from '@/app/components/header/account-setting/model
5353
import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
5454
import Checkbox from '@/app/components/base/checkbox'
5555
import RadioCard from '@/app/components/base/radio-card'
56-
import { IS_CE_EDITION } from '@/config'
56+
import { FULL_DOC_PREVIEW_LENGTH, IS_CE_EDITION } from '@/config'
5757
import Divider from '@/app/components/base/divider'
5858
import { getNotionInfo, getWebsiteInfo, useCreateDocument, useCreateFirstDocument, useFetchDefaultProcessRule, useFetchFileIndexingEstimateForFile, useFetchFileIndexingEstimateForNotion, useFetchFileIndexingEstimateForWeb } from '@/service/knowledge/use-create-dataset'
5959
import Badge from '@/app/components/base/badge'
@@ -1105,14 +1105,17 @@ const StepTwo = ({
11051105
{currentDocForm === ChunkingMode.parentChild && currentEstimateMutation.data?.preview && (
11061106
estimate?.preview?.map((item, index) => {
11071107
const indexForLabel = index + 1
1108+
const childChunks = parentChildConfig.chunkForContext === 'full-doc'
1109+
? item.child_chunks.slice(0, FULL_DOC_PREVIEW_LENGTH)
1110+
: item.child_chunks
11081111
return (
11091112
<ChunkContainer
11101113
key={item.content}
11111114
label={`Chunk-${indexForLabel}`}
11121115
characterCount={item.content.length}
11131116
>
11141117
<FormattedText>
1115-
{item.child_chunks.map((child, index) => {
1118+
{childChunks.map((child, index) => {
11161119
const indexForLabel = index + 1
11171120
return (
11181121
<PreviewSlice

web/config/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -258,3 +258,5 @@ else if (globalThis.document?.body?.getAttribute('data-public-text-generation-ti
258258
export const TEXT_GENERATION_TIMEOUT_MS = textGenerationTimeoutMs
259259

260260
export const DISABLE_UPLOAD_IMAGE_AS_ICON = process.env.NEXT_PUBLIC_DISABLE_UPLOAD_IMAGE_AS_ICON === 'true'
261+
262+
export const FULL_DOC_PREVIEW_LENGTH = 50

0 commit comments

Comments
 (0)