import type { FC } from 'react' import React from 'react' import cn from 'classnames' import { useTranslation } from 'react-i18next' import ReactECharts from 'echarts-for-react' import { SegmentIndexTag } from '../documents/detail/completed' import s from '../documents/detail/completed/style.module.css' import type { SegmentDetailModel } from '@/models/datasets' import Divider from '@/app/components/base/divider' type IScatterChartProps = { data: Array curr: Array } const ScatterChart: FC = ({ data, curr }) => { const option = { xAxis: {}, yAxis: {}, tooltip: { trigger: 'item', axisPointer: { type: 'cross', }, }, series: [ { type: 'effectScatter', symbolSize: 5, data: curr, }, { type: 'scatter', symbolSize: 5, data, }, ], } return ( ) } type IHitDetailProps = { segInfo?: Partial & { id: string } vectorInfo?: { curr: Array; points: Array } } const HitDetail: FC = ({ segInfo, vectorInfo }) => { const { t } = useTranslation() const renderContent = () => { if (segInfo?.answer) { return ( <>
QUESTION
{segInfo.content}
ANSWER
{segInfo.answer}
) } return segInfo?.content } return (
{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}
})}
{t('datasetDocuments.segment.vectorHash')}
{segInfo?.index_node_hash}
) } export default HitDetail