mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-13 03:59:03 +08:00
### What problem does this PR solve? Feat: Adjust the display position of recall test item images #7608 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
573d46a4ef
commit
5c9025918a
@ -129,6 +129,7 @@ export interface ITestingChunk {
|
|||||||
highlight: string;
|
highlight: string;
|
||||||
positions: number[][];
|
positions: number[][];
|
||||||
docnm_kwd: string;
|
docnm_kwd: string;
|
||||||
|
doc_type_kwd: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ITestingDocument {
|
export interface ITestingDocument {
|
||||||
|
@ -34,7 +34,8 @@
|
|||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
.image {
|
.image {
|
||||||
width: 100px;
|
width: 100%;
|
||||||
|
max-height: 30vh;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { ReactComponent as SelectedFilesCollapseIcon } from '@/assets/svg/selected-files-collapse.svg';
|
import { ReactComponent as SelectedFilesCollapseIcon } from '@/assets/svg/selected-files-collapse.svg';
|
||||||
import Image from '@/components/image';
|
|
||||||
import { useTranslate } from '@/hooks/common-hooks';
|
import { useTranslate } from '@/hooks/common-hooks';
|
||||||
import { ITestingChunk } from '@/interfaces/database/knowledge';
|
import { ITestingChunk } from '@/interfaces/database/knowledge';
|
||||||
import {
|
import {
|
||||||
@ -7,9 +6,9 @@ import {
|
|||||||
Collapse,
|
Collapse,
|
||||||
Empty,
|
Empty,
|
||||||
Flex,
|
Flex,
|
||||||
|
Image,
|
||||||
Pagination,
|
Pagination,
|
||||||
PaginationProps,
|
PaginationProps,
|
||||||
Popover,
|
|
||||||
Space,
|
Space,
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import camelCase from 'lodash/camelCase';
|
import camelCase from 'lodash/camelCase';
|
||||||
@ -20,6 +19,7 @@ import {
|
|||||||
useSelectTestingResult,
|
useSelectTestingResult,
|
||||||
} from '@/hooks/knowledge-hooks';
|
} from '@/hooks/knowledge-hooks';
|
||||||
import { useGetPaginationWithRouter } from '@/hooks/logic-hooks';
|
import { useGetPaginationWithRouter } from '@/hooks/logic-hooks';
|
||||||
|
import { api_host } from '@/utils/api';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
|
|
||||||
@ -49,6 +49,12 @@ interface IProps {
|
|||||||
handleTesting: (documentIds?: string[]) => Promise<any>;
|
handleTesting: (documentIds?: string[]) => Promise<any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ShowImageFields = ['image', 'table'];
|
||||||
|
|
||||||
|
function showImage(filed: string) {
|
||||||
|
return ShowImageFields.some((x) => x === filed);
|
||||||
|
}
|
||||||
|
|
||||||
const TestingResult = ({ handleTesting }: IProps) => {
|
const TestingResult = ({ handleTesting }: IProps) => {
|
||||||
const [selectedDocumentIds, setSelectedDocumentIds] = useState<string[]>([]);
|
const [selectedDocumentIds, setSelectedDocumentIds] = useState<string[]>([]);
|
||||||
const { documents, chunks, total } = useSelectTestingResult();
|
const { documents, chunks, total } = useSelectTestingResult();
|
||||||
@ -113,22 +119,16 @@ const TestingResult = ({ handleTesting }: IProps) => {
|
|||||||
{isSuccess && chunks.length > 0 ? (
|
{isSuccess && chunks.length > 0 ? (
|
||||||
chunks?.map((x) => (
|
chunks?.map((x) => (
|
||||||
<Card key={x.chunk_id} title={<ChunkTitle item={x}></ChunkTitle>}>
|
<Card key={x.chunk_id} title={<ChunkTitle item={x}></ChunkTitle>}>
|
||||||
<Flex gap={'middle'}>
|
<div className="flex justify-center">
|
||||||
{x.img_id && (
|
{showImage(x.doc_type_kwd) && (
|
||||||
<Popover
|
<Image
|
||||||
placement="left"
|
id={x.image_id}
|
||||||
content={
|
className={'object-contain max-h-[30vh] w-full text-center'}
|
||||||
<Image
|
src={`${api_host}/document/image/${x.image_id}`}
|
||||||
id={x.img_id}
|
></Image>
|
||||||
className={styles.imagePreview}
|
|
||||||
></Image>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Image id={x.img_id} className={styles.image}></Image>
|
|
||||||
</Popover>
|
|
||||||
)}
|
)}
|
||||||
<div>{x.content_with_weight}</div>
|
</div>
|
||||||
</Flex>
|
<div className="pt-4">{x.content_with_weight}</div>
|
||||||
</Card>
|
</Card>
|
||||||
))
|
))
|
||||||
) : isSuccess && chunks.length === 0 ? (
|
) : isSuccess && chunks.length === 0 ? (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user