fix: add full doc mode preview length limit (#12310)

ok
This commit is contained in:
Wu Tianwei 2025-01-02 18:36:49 +08:00 committed by GitHub
parent 375aa38f5d
commit e58e573f3e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -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 (
<ChunkContainer
key={item.content}
@ -1112,7 +1115,7 @@ const StepTwo = ({
characterCount={item.content.length}
>
<FormattedText>
{item.child_chunks.map((child, index) => {
{childChunks.map((child, index) => {
const indexForLabel = index + 1
return (
<PreviewSlice

View File

@ -258,3 +258,5 @@ else if (globalThis.document?.body?.getAttribute('data-public-text-generation-ti
export const TEXT_GENERATION_TIMEOUT_MS = textGenerationTimeoutMs
export const DISABLE_UPLOAD_IMAGE_AS_ICON = process.env.NEXT_PUBLIC_DISABLE_UPLOAD_IMAGE_AS_ICON === 'true'
export const FULL_DOC_PREVIEW_LENGTH = 50