refactor: enhance document download function with additional parameter and add new MIME types

This commit is contained in:
CaptainB 2025-07-01 15:58:28 +08:00
parent 2ad5883aef
commit cc06d07016
3 changed files with 5 additions and 3 deletions

View File

@ -50,6 +50,7 @@ mime_types = {
"webm": "video/webm", "flv": "video/x-flv", "m4v": "video/x-m4v", "mng": "video/x-mng",
"asx": "video/x-ms-asf", "asf": "video/x-ms-asf", "wmv": "video/x-ms-wmv", "avi": "video/x-msvideo",
"wav": "audio/wav", "flac": "audio/flac", "aac": "audio/aac", "opus": "audio/opus",
"csv": "text/csv", "tsv": "text/tab-separated-values", "ics": "text/calendar",
}

View File

@ -136,11 +136,12 @@ const putCancelTask: (
*
* @param knowledge_id
*/
const getDownloadSourceFile: (knowledge_id: string, document_id: string) => Promise<Result<any>> = (
const getDownloadSourceFile: (knowledge_id: string, document_id: string, document_name: string) => Promise<Result<any>> = (
knowledge_id,
document_id,
document_name,
) => {
return get(`${prefix.value}/${knowledge_id}/document/${document_id}/download_source_file`)
return exportFile(document_name, `${prefix.value}/${knowledge_id}/document/${document_id}/download_source_file`, {}, undefined)
}
/**

View File

@ -944,7 +944,7 @@ function batchRefresh() {
function downloadDocument(row: any) {
loadSharedApi({ type: 'document', systemType: apiType.value })
.getDownloadSourceFile(id, row.id)
.getDownloadSourceFile(id, row.id, row.name)
.then(() => {
getList()
})