feat: transform the parser's data structure and add Image to TestingResult (#63)

* feat: add Image to TestingResult

* feat: transform the parser's data structure
This commit is contained in:
balibabu
2024-02-08 18:50:11 +08:00
committed by GitHub
parent 1a156e6569
commit 53be70c7a9
5 changed files with 75 additions and 34 deletions

View File

@ -33,4 +33,11 @@
font-size: 12px;
font-weight: 500;
}
.image {
width: 100px;
}
.imagePreview {
display: block;
width: 260px;
}
}

View File

@ -1,6 +1,15 @@
import { ReactComponent as SelectedFilesCollapseIcon } from '@/assets/svg/selected-files-collapse.svg';
import Image from '@/components/image';
import { ITestingChunk } from '@/interfaces/database/knowledge';
import { Card, Collapse, Flex, Pagination, PaginationProps, Space } from 'antd';
import {
Card,
Collapse,
Flex,
Pagination,
PaginationProps,
Popover,
Space,
} from 'antd';
import { useDispatch, useSelector } from 'umi';
import { TestingModelState } from '../model';
import styles from './index.less';
@ -92,7 +101,22 @@ const TestingResult = ({ handleTesting }: IProps) => {
>
{chunks.map((x) => (
<Card key={x.chunk_id} title={<ChunkTitle item={x}></ChunkTitle>}>
<div>{x.content_with_weight}</div>
<Flex gap={'middle'}>
{x.img_id && (
<Popover
placement="topRight"
content={
<Image
id={x.img_id}
className={styles.imagePreview}
></Image>
}
>
<Image id={x.img_id} className={styles.image}></Image>
</Popover>
)}
<div>{x.content_with_weight}</div>
</Flex>
</Card>
))}
</Flex>