feat: implement parent-child chunking strategy for enhanced context management

- Added support for parent-child chunking in the knowledge base, allowing for a two-level chunking strategy that improves context retrieval.
- Introduced new configuration options for enabling parent-child chunking, including parent and child chunk sizes.
- Updated relevant components and services to handle parent chunk data, ensuring proper linking and retrieval of child chunks.
- Enhanced user interface elements to reflect the new chunking options and provide better user guidance.

These changes significantly improve the knowledge extraction process by providing richer context through hierarchical chunking.
This commit is contained in:
wizardchen
2026-03-04 20:35:10 +08:00
committed by lyingbug
parent 8399527022
commit b333499078
22 changed files with 1100 additions and 403 deletions
+10 -1
View File
@@ -142,6 +142,9 @@ export default {
loadOriginalFailed: 'Failed to load original file content',
questions: 'Questions',
generatedQuestions: 'Generated Questions',
childChunk: 'Child Chunk',
viewParentContext: 'View Parent Context',
parentContextLoadFailed: 'Failed to load parent context',
confirmDeleteQuestion: 'Are you sure you want to delete this question? The corresponding vector index will also be removed.',
legacyQuestionCannotDelete: 'Legacy format questions cannot be deleted. Please regenerate questions.',
notInitialized: 'Knowledge base is not initialized. Please configure models in settings before uploading files',
@@ -1415,7 +1418,13 @@ export default {
semicolonCn: 'Chinese semicolon (;)',
semicolonEn: 'Semicolon (;)',
space: 'Space ( )'
}
},
parentChildLabel: 'Parent-Child Chunking',
parentChildDescription: 'Enable two-level parent-child chunking strategy. Large parent chunks provide context while small child chunks are used for vector matching.',
parentChunkSizeLabel: 'Parent Chunk Size',
parentChunkSizeDescription: 'Size of parent chunks that provide context (256-4096)',
childChunkSizeLabel: 'Child Chunk Size',
childChunkSizeDescription: 'Size of child chunks used for embedding matching (64-1024)'
},
advanced: {
title: 'Advanced Settings',
+9
View File
@@ -143,6 +143,9 @@ export default {
loadOriginalFailed: "원본 파일 내용 로드 실패",
questions: "질문",
generatedQuestions: "생성된 질문",
childChunk: "자식 청크",
viewParentContext: "부모 컨텍스트 보기",
parentContextLoadFailed: "부모 컨텍스트 로드 실패",
confirmDeleteQuestion:
"이 질문을 삭제하시겠습니까? 삭제 시 해당 벡터 인덱스도 함께 제거됩니다.",
legacyQuestionCannotDelete: "이전 형식의 질문은 삭제할 수 없습니다. 질문을 다시 생성하세요",
@@ -1860,6 +1863,12 @@ export default {
semicolonEn: "영어 세미콜론 (;)",
space: "공백 ( )",
},
parentChildLabel: "부모-자식 청킹",
parentChildDescription: "2단계 부모-자식 청킹 전략을 활성화합니다. 큰 부모 청크는 컨텍스트를 제공하고, 작은 자식 청크는 벡터 매칭에 사용됩니다.",
parentChunkSizeLabel: "부모 청크 크기",
parentChunkSizeDescription: "컨텍스트를 제공하는 부모 청크의 문자 수 (256-4096)",
childChunkSizeLabel: "자식 청크 크기",
childChunkSizeDescription: "임베딩 매칭에 사용되는 자식 청크의 문자 수 (64-1024)",
},
advanced: {
title: "고급 설정",
+10 -1
View File
@@ -118,6 +118,9 @@ export default {
loadOriginalFailed: 'Не удалось загрузить содержимое исходного файла',
questions: 'Вопросы',
generatedQuestions: 'Сгенерированные вопросы',
childChunk: 'Дочерний блок',
viewParentContext: 'Просмотр родительского контекста',
parentContextLoadFailed: 'Не удалось загрузить родительский контекст',
confirmDeleteQuestion: 'Вы уверены, что хотите удалить этот вопрос? Соответствующий векторный индекс также будет удален.',
legacyQuestionCannotDelete: 'Вопросы в устаревшем формате нельзя удалить. Пожалуйста, сгенерируйте вопросы заново.',
notInitialized: 'База знаний не инициализирована. Пожалуйста, настройте модели в разделе настроек перед загрузкой файлов',
@@ -1253,7 +1256,13 @@ export default {
semicolonCn: 'Китайская точка с запятой (;)',
semicolonEn: 'Точка с запятой (;)',
space: 'Пробел ( )'
}
},
parentChildLabel: 'Родительско-дочернее разбиение',
parentChildDescription: 'Включить двухуровневую стратегию разбиения. Большие родительские блоки обеспечивают контекст, а маленькие дочерние блоки используются для векторного поиска.',
parentChunkSizeLabel: 'Размер родительского блока',
parentChunkSizeDescription: 'Размер родительских блоков для контекста (256-4096)',
childChunkSizeLabel: 'Размер дочернего блока',
childChunkSizeDescription: 'Размер дочерних блоков для поиска по эмбеддингам (64-1024)'
},
advanced: {
title: 'Расширенные настройки',
+9
View File
@@ -141,6 +141,9 @@ export default {
loadOriginalFailed: "加载原文件内容失败",
questions: "问题",
generatedQuestions: "生成的问题",
childChunk: "子块",
viewParentContext: "查看父块上下文",
parentContextLoadFailed: "加载父上下文失败",
confirmDeleteQuestion: "确定要删除这个问题吗?删除后将同时移除对应的向量索引。",
legacyQuestionCannotDelete: "旧格式问题无法删除,请重新生成问题",
docActionUnsupported: "当前知识库类型不支持该操作",
@@ -1820,6 +1823,12 @@ export default {
semicolonEn: "英文分号 (;)",
space: "空格 ( )",
},
parentChildLabel: "父子分块",
parentChildDescription: "启用两级父子分块策略。大的父块提供上下文,小的子块用于向量匹配检索。",
parentChunkSizeLabel: "父块大小",
parentChunkSizeDescription: "提供上下文的父块字符数(256-4096)",
childChunkSizeLabel: "子块大小",
childChunkSizeDescription: "用于向量匹配的子块字符数(64-1024)",
},
advanced: {
title: "高级设置",