Refa: migrate document preview/download to RESTful API (#14633)

### What problem does this PR solve?

migrate document preview/download to RESTful API

### Type of change
- [x] Refactoring
This commit is contained in:
buua436
2026-05-08 13:26:13 +08:00
committed by GitHub
parent 412fae7ac2
commit f703169117
11 changed files with 155 additions and 96 deletions

View File

@@ -1,7 +1,7 @@
import { Authorization } from '@/constants/authorization';
import { useGetKnowledgeSearchParams } from '@/hooks/route-hook';
import { useGetPipelineResultSearchParams } from '@/pages/dataflow-result/hooks';
import api, { webAPI } from '@/utils/api';
import api, { restAPIv1 } from '@/utils/api';
import { getAuthorization } from '@/utils/authorization-util';
import jsPreviewExcel from '@js-preview/excel';
import { useSize } from 'ahooks';
@@ -57,7 +57,7 @@ export const useGetDocumentUrl = (isAgent: boolean) => {
if (isAgent) {
return api.downloadFile + `?id=${id}&created_by=${createdBy}`;
}
return `${webAPI}/document/get/${documentId}`;
return `${restAPIv1}/documents/${documentId}/preview`;
}, [createdBy, documentId, id, isAgent]);
return url;