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'
|
2025-06-11 16:38:42 +08:00
|
|
|
import { useTranslation } from 'react-i18next'
|
2025-05-13 11:07:31 +08:00
|
|
|
|
|
|
|
export const useChunkStructure = () => {
|
2025-06-11 16:38:42 +08:00
|
|
|
const { t } = useTranslation()
|
|
|
|
|
2025-05-13 11:07:31 +08:00
|
|
|
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',
|
2025-06-11 16:38:42 +08:00
|
|
|
description: t('datasetCreation.stepTwo.generalTip'),
|
2025-05-13 11:07:31 +08:00
|
|
|
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',
|
2025-06-11 16:38:42 +08:00
|
|
|
description: t('datasetCreation.stepTwo.parentChildTip'),
|
2025-05-13 11:07:31 +08:00
|
|
|
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',
|
2025-06-11 16:38:42 +08:00
|
|
|
description: t('datasetCreation.stepTwo.qaTip'),
|
2025-05-13 11:07:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const options = [
|
|
|
|
GeneralOption,
|
|
|
|
ParentChildOption,
|
|
|
|
QuestionAnswerOption,
|
|
|
|
]
|
|
|
|
|
|
|
|
return {
|
|
|
|
options,
|
|
|
|
}
|
|
|
|
}
|