mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-25 09:53:29 +08:00
Refactor: Migrate document metadata config update API (#14286)
### What problem does this PR solve? Before migration Web API: POST /v1/document/update_metadata_setting After consolidation, Restful API PUT /api/v1/datasets/<dataset_id>/documents/<document_id>/metadata/config ### Type of change - [x] Refactoring
This commit is contained in:
@@ -4,6 +4,7 @@ import { useSelectedIds } from '@/hooks/logic-hooks/use-row-selection';
|
||||
import { DocumentApiAction } from '@/hooks/use-document-request';
|
||||
import kbService, {
|
||||
getMetaDataService,
|
||||
updateDocumentMetaDataConfig,
|
||||
updateMetaData,
|
||||
} from '@/services/knowledge-service';
|
||||
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
@@ -432,10 +433,14 @@ export const useManageMetaDataModal = (
|
||||
const handleSaveSingleFileSettings = useCallback(
|
||||
async (callback: () => void) => {
|
||||
const data = util.tableDataToMetaDataSettingJSON(tableData);
|
||||
if (otherData?.documentId) {
|
||||
const { data: res } = await kbService.documentUpdateMetaData({
|
||||
// otherData contains: documentId
|
||||
if (otherData?.documentId && id) {
|
||||
const { data: res } = await updateDocumentMetaDataConfig({
|
||||
kb_id: id,
|
||||
doc_id: otherData.documentId,
|
||||
metadata: data,
|
||||
data: {
|
||||
metadata: data,
|
||||
},
|
||||
});
|
||||
if (res.code === 0) {
|
||||
message.success(t('message.operated'));
|
||||
|
||||
Reference in New Issue
Block a user