chunking-mode-label.tsx 908 B

123456789101112131415161718192021222324252627282930
  1. 'use client'
  2. import type { FC } from 'react'
  3. import React from 'react'
  4. import { useTranslation } from 'react-i18next'
  5. import Badge from '@/app/components/base/badge'
  6. import { GeneralType, ParentChildType } from '@/app/components/base/icons/src/public/knowledge'
  7. type Props = {
  8. isGeneralMode: boolean
  9. isQAMode: boolean
  10. }
  11. const ChunkingModeLabel: FC<Props> = ({
  12. isGeneralMode,
  13. isQAMode,
  14. }) => {
  15. const { t } = useTranslation()
  16. const TypeIcon = isGeneralMode ? GeneralType : ParentChildType
  17. return (
  18. <Badge>
  19. <div className='flex items-center h-full space-x-0.5 text-text-tertiary'>
  20. <TypeIcon className='w-3 h-3' />
  21. <span className='system-2xs-medium-uppercase'>{isGeneralMode ? `${t('dataset.chunkingMode.general')}${isQAMode ? ' · QA' : ''}` : t('dataset.chunkingMode.parentChild')}</span>
  22. </div>
  23. </Badge>
  24. )
  25. }
  26. export default React.memo(ChunkingModeLabel)