fix: remove Top K in retrieval testing #770 and if the document parsing fails, the error message returned by the backend is displayed (#782)
### What problem does this PR solve? fix: remove Top K in retrieval testing #770 fix: if the document parsing fails, the error message returned by the backend is displayed. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@@ -11,6 +11,8 @@ import {
|
||||
import { useGetChunkHighlights } from '../../hooks';
|
||||
import { useGetDocumentUrl } from './hooks';
|
||||
|
||||
import { useCatchDocumentError } from '@/components/pdf-previewer/hooks';
|
||||
import FileError from '@/pages/document-viewer/file-error';
|
||||
import styles from './index.less';
|
||||
|
||||
interface IProps {
|
||||
@@ -30,9 +32,11 @@ const HighlightPopup = ({
|
||||
// TODO: merge with DocumentPreviewer
|
||||
const Preview = ({ selectedChunkId }: IProps) => {
|
||||
const url = useGetDocumentUrl();
|
||||
useCatchDocumentError(url);
|
||||
const { highlights: state, setWidthAndHeight } =
|
||||
useGetChunkHighlights(selectedChunkId);
|
||||
const ref = useRef<(highlight: IHighlight) => void>(() => {});
|
||||
const error = useCatchDocumentError(url);
|
||||
|
||||
const resetHash = () => {};
|
||||
|
||||
@@ -48,6 +52,7 @@ const Preview = ({ selectedChunkId }: IProps) => {
|
||||
url={url}
|
||||
beforeLoad={<Skeleton active />}
|
||||
workerSrc="/pdfjs-dist/pdf.worker.min.js"
|
||||
errorMessage={<FileError>{error}</FileError>}
|
||||
>
|
||||
{(pdfDocument) => {
|
||||
pdfDocument.getPage(1).then((page) => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import SimilaritySlider from '@/components/similarity-slider';
|
||||
import { Button, Card, Divider, Flex, Form, Input, Slider } from 'antd';
|
||||
import { Button, Card, Divider, Flex, Form, Input } from 'antd';
|
||||
import { FormInstance } from 'antd/lib';
|
||||
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
@@ -9,7 +9,6 @@ import styles from './index.less';
|
||||
type FieldType = {
|
||||
similarity_threshold?: number;
|
||||
vector_similarity_weight?: number;
|
||||
top_k?: number;
|
||||
question: string;
|
||||
};
|
||||
|
||||
@@ -36,22 +35,8 @@ const TestingControl = ({ form, handleTesting }: IProps) => {
|
||||
<p>{t('testingDescription')}</p>
|
||||
<Divider></Divider>
|
||||
<section>
|
||||
<Form
|
||||
name="testing"
|
||||
layout="vertical"
|
||||
form={form}
|
||||
initialValues={{
|
||||
top_k: 1024,
|
||||
}}
|
||||
>
|
||||
<Form name="testing" layout="vertical" form={form}>
|
||||
<SimilaritySlider isTooltipShown></SimilaritySlider>
|
||||
<Form.Item<FieldType>
|
||||
label="Top K"
|
||||
name={'top_k'}
|
||||
tooltip={t('topKTip')}
|
||||
>
|
||||
<Slider marks={{ 0: 0, 2048: 2048 }} max={2048} />
|
||||
</Form.Item>
|
||||
<Card size="small" title={t('testText')}>
|
||||
<Form.Item<FieldType>
|
||||
name={'question'}
|
||||
|
||||
Reference in New Issue
Block a user