feat:新增dify1.11.1版本
This commit is contained in:
45
dify_1.11.1/web/service/knowledge/use-hit-testing.ts
Normal file
45
dify_1.11.1/web/service/knowledge/use-hit-testing.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { useMutation, useQuery } from '@tanstack/react-query'
|
||||
import { useInvalid } from '../use-base'
|
||||
import type {
|
||||
ExternalKnowledgeBaseHitTestingRequest,
|
||||
ExternalKnowledgeBaseHitTestingResponse,
|
||||
HitTestingRecordsRequest,
|
||||
HitTestingRecordsResponse,
|
||||
HitTestingRequest,
|
||||
HitTestingResponse,
|
||||
} from '@/models/datasets'
|
||||
import { get, post } from '../base'
|
||||
|
||||
const NAME_SPACE = 'hit-testing'
|
||||
|
||||
const HitTestingRecordsKey = [NAME_SPACE, 'records']
|
||||
|
||||
export const useHitTestingRecords = (params: HitTestingRecordsRequest) => {
|
||||
const { datasetId, page, limit } = params
|
||||
return useQuery({
|
||||
queryKey: [...HitTestingRecordsKey, datasetId, page, limit],
|
||||
queryFn: () => get<HitTestingRecordsResponse>(`/datasets/${datasetId}/queries`, { params: { page, limit } }),
|
||||
})
|
||||
}
|
||||
|
||||
export const useInvalidateHitTestingRecords = (datasetId: string) => {
|
||||
return useInvalid([...HitTestingRecordsKey, datasetId])
|
||||
}
|
||||
|
||||
export const useHitTesting = (datasetId: string) => {
|
||||
return useMutation({
|
||||
mutationKey: [NAME_SPACE, 'hit-testing', datasetId],
|
||||
mutationFn: (params: HitTestingRequest) => post<HitTestingResponse>(`/datasets/${datasetId}/hit-testing`, {
|
||||
body: params,
|
||||
}),
|
||||
})
|
||||
}
|
||||
|
||||
export const useExternalKnowledgeBaseHitTesting = (datasetId: string) => {
|
||||
return useMutation({
|
||||
mutationKey: [NAME_SPACE, 'external-knowledge-base-hit-testing', datasetId],
|
||||
mutationFn: (params: ExternalKnowledgeBaseHitTestingRequest) => post<ExternalKnowledgeBaseHitTestingResponse>(`/datasets/${datasetId}/external-hit-testing`, {
|
||||
body: params,
|
||||
}),
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user