chore: perfect type definition (#1003)

This commit is contained in:
bowen
2023-08-28 19:48:53 +08:00
committed by GitHub
parent 16199e968e
commit f9bec1edf8
35 changed files with 123 additions and 105 deletions

View File

@@ -10,7 +10,7 @@ type IInfiniteVirtualListProps = {
hasNextPage?: boolean // Are there more items to load? (This information comes from the most recent API request.)
isNextPageLoading: boolean // Are we currently loading a page of items? (This may be an in-flight flag in your Redux store for example.)
items: Array<SegmentDetailModel[]> // Array of items loaded so far.
loadNextPage: () => Promise<any> // Callback function responsible for loading the next page of items.
loadNextPage: () => Promise<void> // Callback function responsible for loading the next page of items.
onClick: (detail: SegmentDetailModel) => void
onChangeSwitch: (segId: string, enabled: boolean) => Promise<void>
onDelete: (segId: string) => Promise<void>

View File

@@ -66,7 +66,7 @@ const SegmentCard: FC<ISegmentCardProps> = ({
hit_count,
index_node_hash,
answer,
} = detail as any
} = detail as Required<ISegmentCardProps>['detail']
const isDocScene = scene === 'doc'
const [showModal, setShowModal] = useState(false)

View File

@@ -177,8 +177,8 @@ const SegmentDetailComponent: FC<ISegmentDetailProps> = ({
</div>
<div className={cn(s.footer, s.numberInfo)}>
<div className='flex items-center'>
<div className={cn(s.commonIcon, s.typeSquareIcon)} /><span className='mr-8'>{formatNumber(segInfo?.word_count as any)} {t('datasetDocuments.segment.characters')}</span>
<div className={cn(s.commonIcon, s.targetIcon)} /><span className='mr-8'>{formatNumber(segInfo?.hit_count as any)} {t('datasetDocuments.segment.hitCount')}</span>
<div className={cn(s.commonIcon, s.typeSquareIcon)} /><span className='mr-8'>{formatNumber(segInfo?.word_count as number)} {t('datasetDocuments.segment.characters')}</span>
<div className={cn(s.commonIcon, s.targetIcon)} /><span className='mr-8'>{formatNumber(segInfo?.hit_count as number)} {t('datasetDocuments.segment.hitCount')}</span>
<div className={cn(s.commonIcon, s.bezierCurveIcon)} /><span className={s.hashText}>{t('datasetDocuments.segment.vectorHash')}{segInfo?.index_node_hash}</span>
</div>
<div className='flex items-center'>