Fix: The dataset retrieval test returned an incorrect total number. (#15901)

### What problem does this PR solve?

Fix: The dataset retrieval test returned an incorrect total number.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

---------

Co-authored-by: balibabu <assassin_cike@163.com>
This commit is contained in:
balibabu
2026-06-10 19:11:31 +08:00
committed by GitHub
parent 2980981da2
commit aafe6c5534
3 changed files with 8 additions and 6 deletions

View File

@@ -1429,7 +1429,6 @@ async def search_datasets(tenant_id: str, req: dict):
except Exception:
logging.warning("search_datasets KG retrieval failed: datasets=%s tenant=%s", kb_ids, tenant_id, exc_info=True)
ranks["chunks"] = settings.retriever.retrieval_by_children(ranks["chunks"], tenant_ids)
ranks["total"] = len(ranks["chunks"])
for c in ranks["chunks"]:
c.pop("vector", None)

View File

@@ -87,21 +87,24 @@ export const useTestRetrieval = () => {
});
const refetch = useCallback(() => {
setPage(1);
if (queryParams.question) {
mutation.mutate(queryParams);
const newParams = { ...queryParams, page: 1 };
mutation.mutate(newParams);
}
}, [mutation, queryParams]);
const onPaginationChange = useCallback(
(newPage: number, newPageSize: number) => {
setPage(newPage);
const nextPage = newPageSize !== pageSize ? 1 : newPage;
setPage(nextPage);
setPageSize(newPageSize);
if (mutation.data && queryParams.question) {
const newParams = { ...queryParams, page: newPage, size: newPageSize };
const newParams = { ...queryParams, page: nextPage, size: newPageSize };
mutation.mutate(newParams);
}
},
[mutation, queryParams],
[mutation, queryParams, pageSize],
);
const handleFilterSubmit = useCallback(

View File

@@ -24,7 +24,7 @@ export default function RetrievalTesting() {
filterValue,
} = useTestRetrieval();
const [count] = useState(1);
const [count] = useState(1); // TODO: Different layouts are needed; if they are no longer required, consider deleting them.
return (
<div className="pr-5 pb-5">