Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: #21427 correct segment settings when creating documents via API (#21673)

qiuqiua18757d07c942
diff --git a/web/app/components/datasets/create/step-two/index.tsx b/web/app/components/datasets/create/step-two/index.tsx
index 9a76bc6834b..ebd8552a99e 100644
--- a/web/app/components/datasets/create/step-two/index.tsx
+++ b/web/app/components/datasets/create/step-two/index.tsx
@@ -507,13 +507,15 @@ const StepTwo = ({
const separator = rules.segmentation.separator
const max = rules.segmentation.max_tokens
const overlap = rules.segmentation.chunk_overlap
+ const isHierarchicalDocument = documentDetail.doc_form === ChunkingMode.parentChild
+ || (rules.parent_mode && rules.subchunk_segmentation)
setSegmentIdentifier(separator)
setMaxChunkLength(max)
setOverlap(overlap!)
setRules(rules.pre_processing_rules)
setDefaultConfig(rules)
- if (documentDetail.dataset_process_rule.mode === 'hierarchical') {
+ if (isHierarchicalDocument) {
setParentChildConfig({
chunkForContext: rules.parent_mode || 'paragraph',
parent: {