mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-23 00:46:42 +08:00
Refactor: migrate chunk retrieval_test and knowledge_graph to REST API endpoints (#14402)
### What problem does this PR solve? ## Summary Migrate two web API endpoints to REST-style HTTP API endpoints, following the pattern established in #14222: | Old Endpoint | New Endpoint | |---|---| | `POST /v1/chunk/retrieval_test` | `POST /api/v1/datasets/<dataset_id>/search` | | `GET /v1/chunk/knowledge_graph` | `GET /api/v1/datasets/<dataset_id>/graph` |
This commit is contained in:
@@ -18,11 +18,9 @@ const {
|
||||
documentChangeStatus,
|
||||
documentChangeParser,
|
||||
documentThumbnails,
|
||||
retrievalTest,
|
||||
documentIngest,
|
||||
documentUpload,
|
||||
webCrawl,
|
||||
knowledgeGraph,
|
||||
listTagByKnowledgeIds,
|
||||
setMeta,
|
||||
getMeta,
|
||||
@@ -71,14 +69,6 @@ const methods = {
|
||||
url: setMeta,
|
||||
method: 'post',
|
||||
},
|
||||
retrievalTest: {
|
||||
url: retrievalTest,
|
||||
method: 'post',
|
||||
},
|
||||
knowledgeGraph: {
|
||||
url: knowledgeGraph,
|
||||
method: 'get',
|
||||
},
|
||||
listTagByKnowledgeIds: {
|
||||
url: listTagByKnowledgeIds,
|
||||
method: 'get',
|
||||
@@ -151,6 +141,17 @@ const getAvailableParam = (available?: number) => {
|
||||
};
|
||||
|
||||
const chunkService = {
|
||||
retrievalTest: async (params: Record<string, any>) => {
|
||||
const datasetId = getDatasetId(params);
|
||||
if (!datasetId) {
|
||||
throw new Error(
|
||||
'dataset_id (or kb_id/knowledge_id) is required for retrievalTest',
|
||||
);
|
||||
}
|
||||
return request.post(api.retrievalTest(datasetId), {
|
||||
data: params,
|
||||
});
|
||||
},
|
||||
chunkList: async (params: Record<string, any>) => {
|
||||
const datasetId = getDatasetId(params);
|
||||
const documentId = getDocumentId(params);
|
||||
|
||||
@@ -66,6 +66,8 @@ export default {
|
||||
getKbDetail: (datasetId: string) => `${restAPIv1}/datasets/${datasetId}`,
|
||||
getKnowledgeGraph: (knowledgeId: string) =>
|
||||
`${restAPIv1}/datasets/${knowledgeId}/graph/search`,
|
||||
knowledgeGraph: (datasetId: string) =>
|
||||
`${restAPIv1}/datasets/${datasetId}/graph`,
|
||||
deleteKnowledgeGraph: (knowledgeId: string) =>
|
||||
`${restAPIv1}/datasets/${knowledgeId}/graph`,
|
||||
getMeta: `${restAPIv1}/datasets/metadata/flattened`,
|
||||
@@ -107,8 +109,8 @@ export default {
|
||||
`${restAPIv1}/datasets/${datasetId}/documents/${documentId}/chunks`,
|
||||
chunkDetail: (datasetId: string, documentId: string, chunkId: string) =>
|
||||
`${restAPIv1}/datasets/${datasetId}/documents/${documentId}/chunks/${chunkId}`,
|
||||
retrievalTest: `${webAPI}/chunk/retrieval_test`,
|
||||
knowledgeGraph: `${webAPI}/chunk/knowledge_graph`,
|
||||
retrievalTest: (datasetId: string) =>
|
||||
`${restAPIv1}/datasets/${datasetId}/search`,
|
||||
|
||||
// document
|
||||
getDocumentList: (datasetId: string) =>
|
||||
|
||||
Reference in New Issue
Block a user