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
refactor: remove enable_multimodal and adjust parent-child configuration
wizardchend8a26f7c2389
diff --git a/frontend/src/types/knowledgeProcess.ts b/frontend/src/types/knowledgeProcess.tsindex 40c6b73d0..d1c7af16b 100644--- a/frontend/src/types/knowledgeProcess.ts+++ b/frontend/src/types/knowledgeProcess.ts@@ -9,7 +9,6 @@ export interface ChunkingConfigOverride {chunk_size?: numberchunk_overlap?: numberseparators?: string[]- enable_multimodal?: booleanparser_engine_rules?: ParserEngineRule[]enable_parent_child?: booleanparent_chunk_size?: numberdiff --git a/frontend/src/views/knowledge/KnowledgeBaseEditorModal.vue b/frontend/src/views/knowledge/KnowledgeBaseEditorModal.vueindex fd74758cb..1e5bc6c69 100644--- a/frontend/src/views/knowledge/KnowledgeBaseEditorModal.vue+++ b/frontend/src/views/knowledge/KnowledgeBaseEditorModal.vue@@ -1026,7 +1026,6 @@ const buildSubmitData = () => {chunk_size: formData.value.chunkingConfig.chunkSize,chunk_overlap: formData.value.chunkingConfig.chunkOverlap,separators: formData.value.chunkingConfig.separators,- enable_multimodal: formData.value.multimodalConfig.enabled,enable_parent_child: formData.value.chunkingConfig.enableParentChild,parent_chunk_size: formData.value.chunkingConfig.parentChunkSize,child_chunk_size: formData.value.chunkingConfig.childChunkSize,diff --git a/frontend/src/views/knowledge/components/UploadConfirmDialog.vue b/frontend/src/views/knowledge/components/UploadConfirmDialog.vueindex b812d7c7f..ae4f61efe 100644--- a/frontend/src/views/knowledge/components/UploadConfirmDialog.vue+++ b/frontend/src/views/knowledge/components/UploadConfirmDialog.vue@@ -622,7 +622,7 @@ function initFromKbInfo(kb: any) {chunkOverlap: kb.chunking_config?.chunk_overlap || 80,separators: kb.chunking_config?.separators || ['\n\n', '\n', '。', '!', '?', ';', ';'],parserEngineRules: kb.chunking_config?.parser_engine_rules || undefined,- enableParentChild: kb.chunking_config?.enable_parent_child ?? true,+ enableParentChild: kb.chunking_config?.enable_parent_child ?? false,parentChunkSize: kb.chunking_config?.parent_chunk_size || 4096,childChunkSize: kb.chunking_config?.child_chunk_size || 384,strategy: kb.chunking_config?.strategy || 'auto',diff --git a/internal/application/service/knowledge_process_config.go b/internal/application/service/knowledge_process_config.goindex 13e8822bd..a0f728e92 100644--- a/internal/application/service/knowledge_process_config.go+++ b/internal/application/service/knowledge_process_config.go@@ -149,15 +149,12 @@ func mergeChunkingConfig(base types.ChunkingConfig, override *types.ChunkingConfif len(override.Separators) > 0 {result.Separators = override.Separators}- if override.EnableMultimodal {- result.EnableMultimodal = override.EnableMultimodal- }if len(override.ParserEngineRules) > 0 {result.ParserEngineRules = override.ParserEngineRules}- if override.EnableParentChild {- result.EnableParentChild = override.EnableParentChild- }+ // EnableParentChild is authoritative: callers send a full chunking snapshot,+ // so an explicit false must be able to turn parent-child off (not just on).+ result.EnableParentChild = override.EnableParentChildif override.ParentChunkSize != 0 {result.ParentChunkSize = override.ParentChunkSize}diff --git a/internal/application/service/knowledge_process_config_test.go b/internal/application/service/knowledge_process_config_test.goindex eef18c4b5..3ca42e82d 100644--- a/internal/application/service/knowledge_process_config_test.go+++ b/internal/application/service/knowledge_process_config_test.go@@ -34,6 +34,28 @@ func TestResolveProcessConfig_OverridesChunkSize(t *testing.T) {require.Equal(t, 50, eff.ChunkingConfig.ChunkOverlap)}+func TestResolveProcessConfig_OverrideTogglesParentChild(t *testing.T) {+ t.Parallel()++ // KB has parent-child on; override snapshot turns it off.+ kbOn := &types.KnowledgeBase{+ ChunkingConfig: types.ChunkingConfig{ChunkSize: 512, EnableParentChild: true},+ }+ effOff := ResolveProcessConfig(kbOn, &types.KnowledgeProcessOverrides{+ ChunkingConfig: &types.ChunkingConfig{ChunkSize: 512, EnableParentChild: false},+ })+ require.False(t, effOff.ChunkingConfig.EnableParentChild)++ // KB has parent-child off; override snapshot turns it on.+ kbOff := &types.KnowledgeBase{+ ChunkingConfig: types.ChunkingConfig{ChunkSize: 512, EnableParentChild: false},+ }+ effOn := ResolveProcessConfig(kbOff, &types.KnowledgeProcessOverrides{+ ChunkingConfig: &types.ChunkingConfig{ChunkSize: 512, EnableParentChild: true},+ })+ require.True(t, effOn.ChunkingConfig.EnableParentChild)+}+func TestResolveProcessConfig_GraphDisabled(t *testing.T) {t.Parallel()@@ -70,7 +92,6 @@ func TestResolveProcessConfig_NilOverridesUsesKBDefaults(t *testing.T) {IndexingStrategy: types.IndexingStrategy{GraphEnabled: true},ExtractConfig: &types.ExtractConfig{Enabled: true, Tags: []string{"tag-a"}},}- kb.ChunkingConfig.EnableMultimodal = trueeff := ResolveProcessConfig(kb, nil)diff --git a/internal/types/knowledgebase.go b/internal/types/knowledgebase.goindex 2b13e7ceb..f26986ee9 100644--- a/internal/types/knowledgebase.go+++ b/internal/types/knowledgebase.go@@ -154,8 +154,6 @@ type ChunkingConfig struct {ChunkOverlap int `yaml:"chunk_overlap" json:"chunk_overlap"`// SeparatorsSeparators []string `yaml:"separators" json:"separators"`- // EnableMultimodal (deprecated, kept for backward compatibility with old data)- EnableMultimodal bool `yaml:"enable_multimodal,omitempty" json:"enable_multimodal,omitempty"`// ParserEngineRules configures which parser engine to use for each file type.// When empty, the builtin engine is used for all types.ParserEngineRules []ParserEngineRule `yaml:"parser_engine_rules,omitempty" json:"parser_engine_rules,omitempty"`@@ -658,22 +656,12 @@ func (kb *KnowledgeBase) NeedsEmbeddingModel() bool {return kb != nil && kb.IndexingStrategy.NeedsEmbedding()}-// IsMultimodalEnabled 判断多模态是否启用(兼容新老版本配置)-// 新版本:VLMConfig.IsEnabled()-// 老版本:ChunkingConfig.EnableMultimodal+// IsMultimodalEnabled 判断多模态是否启用,由 VLMConfig.IsEnabled() 决定。func (kb *KnowledgeBase) IsMultimodalEnabled() bool {if kb == nil {return false}- // 新版本配置优先- if kb.VLMConfig.IsEnabled() {- return true- }- // 兼容老版本:chunking_config 中的 enable_multimodal 字段- if kb.ChunkingConfig.EnableMultimodal {- return true- }- return false+ return kb.VLMConfig.IsEnabled()}// HasVectorStore reports whether the KB is bound to a DB-managed VectorStore