mirror of
https://github.com/langgenius/dify.git
synced 2026-08-02 10:46:38 +08:00
29 lines
780 B
TypeScript
29 lines
780 B
TypeScript
import { consoleQuery } from '@/service/client'
|
|
|
|
const CHUNK_PAGE_SIZE = 100
|
|
|
|
export function documentChunksQueryOptions({
|
|
documentId,
|
|
effectiveRevision,
|
|
knowledgeSpaceId,
|
|
}: {
|
|
documentId: string
|
|
effectiveRevision: number
|
|
knowledgeSpaceId: string
|
|
}) {
|
|
const chunksQuery =
|
|
consoleQuery.knowledgeFs.getKnowledgeSpacesByIdDocumentsByDocumentIdRevisionsByRevisionChunks
|
|
|
|
return chunksQuery.infiniteOptions({
|
|
input: (pageParam) => ({
|
|
params: { documentId, id: knowledgeSpaceId, revision: effectiveRevision },
|
|
query: {
|
|
limit: CHUNK_PAGE_SIZE,
|
|
...(typeof pageParam === 'string' ? { cursor: pageParam } : {}),
|
|
},
|
|
}),
|
|
getNextPageParam: (lastPage) => lastPage.nextCursor,
|
|
initialPageParam: null as string | null,
|
|
})
|
|
}
|