Feat: Rendering a search test list with real data #3221 (#7138)

### What problem does this PR solve?

Feat: Rendering a search test list with real data #3221
### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-04-18 16:29:41 +08:00
committed by GitHub
parent 1b4016317e
commit 42e236f464
4 changed files with 60 additions and 31 deletions

View File

@ -1,3 +1,4 @@
import { INextTestingResult } from '@/interfaces/database/knowledge';
import { ITestRetrievalRequestBody } from '@/interfaces/request/knowledge';
import kbService from '@/services/knowledge-service';
import { useQuery } from '@tanstack/react-query';
@ -33,14 +34,18 @@ export const useTestRetrieval = () => {
data,
isFetching: loading,
refetch,
} = useQuery<any>({
} = useQuery<INextTestingResult>({
queryKey: [KnowledgeApiAction.TestRetrieval, queryParams],
initialData: {},
// enabled: !!values?.question && !!knowledgeBaseId,
initialData: {
chunks: [],
doc_aggs: [],
total: 0,
},
enabled: false,
gcTime: 0,
queryFn: async () => {
const { data } = await kbService.retrieval_test(queryParams);
console.log('🚀 ~ queryFn: ~ data:', data);
return data?.data ?? {};
},
});