mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 01:48:04 +08:00
refactor(app-asset): migrate file upload to presigned URL and batch upload
- Replace FormData file upload with presigned URL two-step upload - Add batch-upload contract for folder uploads (reduces N+M to 1+M requests) - Remove deprecated createFile contract and useCreateAppAssetFile hook - Remove checksum field from AppAssetNode and AppAssetTreeView types - Add upload-to-presigned-url utility for direct storage uploads
This commit is contained in:
@ -4,7 +4,11 @@ import type {
|
||||
AppAssetNode,
|
||||
AppAssetPublishResponse,
|
||||
AppAssetTreeResponse,
|
||||
BatchUploadPayload,
|
||||
BatchUploadResponse,
|
||||
CreateFolderPayload,
|
||||
FileUploadUrlResponse,
|
||||
GetFileUploadUrlPayload,
|
||||
MoveNodePayload,
|
||||
RenameNodePayload,
|
||||
ReorderNodePayload,
|
||||
@ -33,16 +37,6 @@ export const createFolderContract = base
|
||||
}>())
|
||||
.output(type<AppAssetNode>())
|
||||
|
||||
export const createFileContract = base
|
||||
.route({
|
||||
path: '/apps/{appId}/assets/files',
|
||||
method: 'POST',
|
||||
})
|
||||
.input(type<{
|
||||
params: { appId: string }
|
||||
}>())
|
||||
.output(type<AppAssetNode>())
|
||||
|
||||
export const getFileContentContract = base
|
||||
.route({
|
||||
path: '/apps/{appId}/assets/files/{nodeId}',
|
||||
@ -126,3 +120,25 @@ export const publishContract = base
|
||||
params: { appId: string }
|
||||
}>())
|
||||
.output(type<AppAssetPublishResponse>())
|
||||
|
||||
export const getFileUploadUrlContract = base
|
||||
.route({
|
||||
path: '/apps/{appId}/assets/files/upload',
|
||||
method: 'POST',
|
||||
})
|
||||
.input(type<{
|
||||
params: { appId: string }
|
||||
body: GetFileUploadUrlPayload
|
||||
}>())
|
||||
.output(type<FileUploadUrlResponse>())
|
||||
|
||||
export const batchUploadContract = base
|
||||
.route({
|
||||
path: '/apps/{appId}/assets/batch-upload',
|
||||
method: 'POST',
|
||||
})
|
||||
.input(type<{
|
||||
params: { appId: string }
|
||||
body: BatchUploadPayload
|
||||
}>())
|
||||
.output(type<BatchUploadResponse>())
|
||||
|
||||
Reference in New Issue
Block a user