Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
feat: update chunk size configurations for knowledge base processing
wizardchenb697d4945eb6
diff --git a/frontend/src/views/knowledge/KnowledgeBaseEditorModal.vue b/frontend/src/views/knowledge/KnowledgeBaseEditorModal.vueindex 9cd6e36be..c098d2ec1 100644--- a/frontend/src/views/knowledge/KnowledgeBaseEditorModal.vue+++ b/frontend/src/views/knowledge/KnowledgeBaseEditorModal.vue@@ -298,8 +298,8 @@ const initFormData = (type: 'document' | 'faq' = 'document') => {separators: ['\n\n', '\n', '。', '!', '?', ';', ';'],parserEngineRules: undefined as any,enableParentChild: false,- parentChunkSize: 1024,- childChunkSize: 256+ parentChunkSize: 4096,+ childChunkSize: 384},storageProvider: 'local' as string,multimodalConfig: {@@ -378,8 +378,8 @@ const loadKBData = async () => {separators: kb.chunking_config?.separators || ['\n\n', '\n', '。', '!', '?', ';', ';'],parserEngineRules: kb.chunking_config?.parser_engine_rules || undefined,enableParentChild: kb.chunking_config?.enable_parent_child || false,- parentChunkSize: kb.chunking_config?.parent_chunk_size || 1024,- childChunkSize: kb.chunking_config?.child_chunk_size || 256+ parentChunkSize: kb.chunking_config?.parent_chunk_size || 4096,+ childChunkSize: kb.chunking_config?.child_chunk_size || 384},storageProvider: (kb.storage_config?.provider || 'local') as string,multimodalConfig: {@@ -614,8 +614,8 @@ const handleSubmit = async () => {separators: data.chunking_config.separators,parserEngineRules: data.chunking_config.parser_engine_rules || undefined,enableParentChild: data.chunking_config.enable_parent_child || false,- parentChunkSize: data.chunking_config.parent_chunk_size || 1024,- childChunkSize: data.chunking_config.child_chunk_size || 256+ parentChunkSize: data.chunking_config.parent_chunk_size || 4096,+ childChunkSize: data.chunking_config.child_chunk_size || 384},multimodal: {enabled: !!data.vlm_config?.enableddiff --git a/frontend/src/views/knowledge/settings/KBChunkingSettings.vue b/frontend/src/views/knowledge/settings/KBChunkingSettings.vueindex c8a2f61e2..528ec4fab 100644--- a/frontend/src/views/knowledge/settings/KBChunkingSettings.vue+++ b/frontend/src/views/knowledge/settings/KBChunkingSettings.vue@@ -94,10 +94,10 @@<div class="slider-container"><t-sliderv-model="localParentChunkSize"- :min="256"- :max="4096"+ :min="512"+ :max="8192":step="64"- :marks="{ 256: '256', 1024: '1024', 2048: '2048', 4096: '4096' }"+ :marks="{ 512: '512', 2048: '2048', 4096: '4096', 8192: '8192' }"@change="handleParentChunkSizeChange"style="width: 200px;"/>@@ -117,9 +117,9 @@<t-sliderv-model="localChildChunkSize":min="64"- :max="1024"+ :max="2048":step="32"- :marks="{ 64: '64', 256: '256', 512: '512', 1024: '1024' }"+ :marks="{ 64: '64', 384: '384', 1024: '1024', 2048: '2048' }"@change="handleChildChunkSizeChange"style="width: 200px;"/>@@ -164,8 +164,8 @@ const localChunkSize = ref(props.config.chunkSize)const localChunkOverlap = ref(props.config.chunkOverlap)const localSeparators = ref([...props.config.separators])const localEnableParentChild = ref(props.config.enableParentChild ?? false)-const localParentChunkSize = ref(props.config.parentChunkSize || 1024)-const localChildChunkSize = ref(props.config.childChunkSize || 256)+const localParentChunkSize = ref(props.config.parentChunkSize || 4096)+const localChildChunkSize = ref(props.config.childChunkSize || 384)const { t } = useI18n()const separatorOptions = computed(() => [@@ -184,8 +184,8 @@ watch(() => props.config, (newConfig) => {localChunkOverlap.value = newConfig.chunkOverlaplocalSeparators.value = [...newConfig.separators]localEnableParentChild.value = newConfig.enableParentChild ?? false- localParentChunkSize.value = newConfig.parentChunkSize || 1024- localChildChunkSize.value = newConfig.childChunkSize || 256+ localParentChunkSize.value = newConfig.parentChunkSize || 4096+ localChildChunkSize.value = newConfig.childChunkSize || 384}, { deep: true })const handleChunkSizeChange = () => { emitUpdate() }diff --git a/internal/application/service/knowledge.go b/internal/application/service/knowledge.goindex 1171b9c63..c4c9bd83e 100644--- a/internal/application/service/knowledge.go+++ b/internal/application/service/knowledge.go@@ -1326,11 +1326,11 @@ type ProcessChunksOptions struct {func buildParentChildConfigs(cc types.ChunkingConfig, base chunker.SplitterConfig) (parent, child chunker.SplitterConfig) {parentSize := cc.ParentChunkSizeif parentSize <= 0 {- parentSize = 1024+ parentSize = 4096}childSize := cc.ChildChunkSizeif childSize <= 0 {- childSize = 256+ childSize = 384}parent = chunker.SplitterConfig{ChunkSize: parentSize,diff --git a/internal/types/knowledgebase.go b/internal/types/knowledgebase.goindex a96392aa1..f5099e465 100644--- a/internal/types/knowledgebase.go+++ b/internal/types/knowledgebase.go@@ -125,10 +125,10 @@ type ChunkingConfig struct {// When enabled, large parent chunks provide context while small child chunks// are used for vector matching. Retrieval matches on child but returns parent content.EnableParentChild bool `yaml:"enable_parent_child,omitempty" json:"enable_parent_child,omitempty"`- // ParentChunkSize is the size of parent chunks (default: 1024).+ // ParentChunkSize is the size of parent chunks (default: 4096).// Only used when EnableParentChild is true.ParentChunkSize int `yaml:"parent_chunk_size,omitempty" json:"parent_chunk_size,omitempty"`- // ChildChunkSize is the size of child chunks used for embedding (default: 256).+ // ChildChunkSize is the size of child chunks used for embedding (default: 384).// Only used when EnableParentChild is true.ChildChunkSize int `yaml:"child_chunk_size,omitempty" json:"child_chunk_size,omitempty"`}