import type { FC } from 'react' import React from 'react' import { useTranslation } from 'react-i18next' import { SegmentIndexTag } from '../documents/detail/completed' import s from '../documents/detail/completed/style.module.css' import cn from '@/utils/classnames' import type { SegmentDetailModel } from '@/models/datasets' import Divider from '@/app/components/base/divider' type IHitDetailProps = { segInfo?: Partial & { id: string } } const HitDetail: FC = ({ segInfo }) => { const { t } = useTranslation() const renderContent = () => { if (segInfo?.answer) { return ( <>
QUESTION
{segInfo.content}
ANSWER
{segInfo.answer}
) } return
{segInfo?.content}
} return ( segInfo?.id === 'external' ?
{renderContent()}
:
{segInfo?.word_count} {t('datasetDocuments.segment.characters')}
{segInfo?.hit_count} {t('datasetDocuments.segment.hitCount')}
{renderContent()}
{t('datasetDocuments.segment.keywords')}
{!segInfo?.keywords?.length ? '-' : segInfo?.keywords?.map((word, index) => { return
{word}
})}
) } export default HitDetail