Files
ragflow/web/src/pages/dataset/testing/index.tsx
chanx edb32b1304 fix: Change the data in the dataset page to be obtained using the interface (#8726)
### What problem does this PR solve?

Change the data in the dataset page to be obtained using the interface,
and change the import to obtain all data every 15 seconds to obtain the
data of the current page every 5 seconds when parsing the existing file.
[#3221](https://github.com/infiniflow/ragflow/issues/3221)

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-07-08 19:19:07 +08:00

106 lines
3.0 KiB
TypeScript

import { useTestRetrieval } from '@/hooks/use-knowledge-request';
import { useCallback, useState } from 'react';
import { TopTitle } from '../dataset-title';
import TestingForm from './testing-form';
import { TestingResult } from './testing-result';
function Vertical() {
return <div>xxx</div>;
}
export default function RetrievalTesting() {
const {
loading,
setValues,
refetch,
data,
onPaginationChange,
page,
pageSize,
handleFilterSubmit,
filterValue,
} = useTestRetrieval();
const [count, setCount] = useState(1);
const addCount = useCallback(() => {
setCount(2);
}, []);
const removeCount = useCallback(() => {
setCount(1);
}, []);
return (
<div className="p-5">
<section className="flex justify-between items-center">
<TopTitle
title={'Retrieval testing'}
description={`Conduct a retrieval test to check if RAGFlow can recover the intended content for the LLM.`}
></TopTitle>
{/* <Button>Save as Preset</Button> */}
</section>
{count === 1 ? (
<section className="flex divide-x h-full">
<div className="p-4 flex-1">
<div className="flex justify-between pb-2.5">
<span className="text-text-title font-semibold text-2xl">
Test setting
</span>
{/* <Button variant={'outline'} onClick={addCount}>
<Plus /> Add New Test
</Button> */}
</div>
<TestingForm
loading={loading}
setValues={setValues}
refetch={refetch}
></TestingForm>
</div>
<TestingResult
data={data}
page={page}
pageSize={pageSize}
filterValue={filterValue}
handleFilterSubmit={handleFilterSubmit}
onPaginationChange={onPaginationChange}
></TestingResult>
</section>
) : (
<section className="flex gap-2">
<div className="flex-1">
<TestingForm
loading={loading}
setValues={setValues}
refetch={refetch}
></TestingForm>
<TestingResult
data={data}
page={page}
pageSize={pageSize}
filterValue={filterValue}
handleFilterSubmit={handleFilterSubmit}
onPaginationChange={onPaginationChange}
></TestingResult>
</div>
<div className="flex-1">
<TestingForm
loading={loading}
setValues={setValues}
refetch={refetch}
></TestingForm>
<TestingResult
data={data}
page={page}
pageSize={pageSize}
filterValue={filterValue}
handleFilterSubmit={handleFilterSubmit}
onPaginationChange={onPaginationChange}
></TestingResult>
</div>
</section>
)}
</div>
);
}