mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
refactor: enhance document download function with additional parameter and add new MIME types
This commit is contained in:
parent
2ad5883aef
commit
cc06d07016
|
|
@ -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",
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue