dify/web/app/components/datasets/common/chunking-mode-label.tsx
Stephen Zhou a84c2d36a3
style: format with vp fmt (#38803)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-07-12 15:57:46 +00:00

32 lines
1.0 KiB
TypeScript

'use client'
import type { FC } from 'react'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import Badge from '@/app/components/base/badge'
import { GeneralChunk, ParentChildChunk } from '@/app/components/base/icons/src/vender/knowledge'
type Props = Readonly<{
isGeneralMode: boolean
isQAMode: boolean
}>
const ChunkingModeLabel: FC<Props> = ({ isGeneralMode, isQAMode }) => {
const { t } = useTranslation()
const TypeIcon = isGeneralMode ? GeneralChunk : ParentChildChunk
const generalSuffix = isQAMode ? ' · QA' : ''
return (
<Badge>
<div className="flex h-full items-center space-x-0.5 text-text-tertiary">
<TypeIcon className="size-3" />
<span className="system-2xs-medium-uppercase">
{isGeneralMode
? `${t(($) => $['chunkingMode.general'], { ns: 'dataset' })}${generalSuffix}`
: t(($) => $['chunkingMode.parentChild'], { ns: 'dataset' })}
</span>
</div>
</Badge>
)
}
export default React.memo(ChunkingModeLabel)