2025-05-13 11:07:31 +08:00
import {
GeneralChunk ,
ParentChildChunk ,
QuestionAndAnswer ,
} from '@/app/components/base/icons/src/vender/knowledge'
import { EffectColor , type Option } from './types'
import { ChunkingMode } from '@/models/datasets'
export const useChunkStructure = ( ) = > {
const GeneralOption : Option = {
id : ChunkingMode.text ,
2025-05-13 15:35:21 +08:00
icon : < GeneralChunk className = 'size-[18px]' / > ,
iconActiveColor : 'text-util-colors-indigo-indigo-600' ,
2025-05-13 11:07:31 +08:00
title : 'General' ,
description : 'General text chunking mode, the chunks retrieved and recalled are the same.' ,
effectColor : EffectColor.indigo ,
showEffectColor : true ,
}
const ParentChildOption : Option = {
id : ChunkingMode.parentChild ,
2025-05-13 15:35:21 +08:00
icon : < ParentChildChunk className = 'size-[18px]' / > ,
iconActiveColor : 'text-util-colors-blue-light-blue-light-500' ,
2025-05-13 11:07:31 +08:00
title : 'Parent-Child' ,
description : 'When using the parent-child mode, the child-chunk is used for retrieval and the parent-chunk is used for recall as context.' ,
effectColor : EffectColor.blueLight ,
showEffectColor : true ,
}
const QuestionAnswerOption : Option = {
id : ChunkingMode.qa ,
2025-05-13 15:35:21 +08:00
icon : < QuestionAndAnswer className = 'size-[18px]' / > ,
2025-05-13 11:07:31 +08:00
title : 'Q&A' ,
description : 'When using structured Q&A data, you can create documents that pair questions with answers. These documents are indexed based on the question portion, allowing the system to retrieve relevant answers based on query similarity' ,
}
const options = [
GeneralOption ,
ParentChildOption ,
QuestionAnswerOption ,
]
return {
options ,
}
}