@@ -30,6 +30,8 @@ type FileInfo struct { | |||||
} | } | ||||
type FileInfoList []FileInfo | type FileInfoList []FileInfo | ||||
const MAX_LIST_PARTS = 1000 | |||||
func (ulist FileInfoList) Swap(i, j int) { ulist[i], ulist[j] = ulist[j], ulist[i] } | func (ulist FileInfoList) Swap(i, j int) { ulist[i], ulist[j] = ulist[j], ulist[i] } | ||||
func (ulist FileInfoList) Len() int { return len(ulist) } | func (ulist FileInfoList) Len() int { return len(ulist) } | ||||
func (ulist FileInfoList) Less(i, j int) bool { | func (ulist FileInfoList) Less(i, j int) bool { | ||||
@@ -97,29 +99,48 @@ func CompleteObsMultiPartUpload(uuid, uploadID, fileName string) error { | |||||
input.Bucket = setting.Bucket | input.Bucket = setting.Bucket | ||||
input.Key = strings.TrimPrefix(path.Join(setting.BasePath, path.Join(uuid[0:1], uuid[1:2], uuid, fileName)), "/") | input.Key = strings.TrimPrefix(path.Join(setting.BasePath, path.Join(uuid[0:1], uuid[1:2], uuid, fileName)), "/") | ||||
input.UploadId = uploadID | input.UploadId = uploadID | ||||
output, err := ObsCli.ListParts(&obs.ListPartsInput{ | |||||
Bucket: setting.Bucket, | |||||
Key: input.Key, | |||||
UploadId: uploadID, | |||||
}) | |||||
if err != nil { | |||||
log.Error("ListParts failed:", err.Error()) | |||||
return err | |||||
} | |||||
for _, partInfo := range output.Parts { | |||||
input.Parts = append(input.Parts, obs.Part{ | |||||
PartNumber: partInfo.PartNumber, | |||||
ETag: partInfo.ETag, | |||||
partNumberMarker := 0 | |||||
for { | |||||
output, err := ObsCli.ListParts(&obs.ListPartsInput{ | |||||
Bucket: setting.Bucket, | |||||
Key: input.Key, | |||||
UploadId: uploadID, | |||||
MaxParts: MAX_LIST_PARTS, | |||||
PartNumberMarker: partNumberMarker, | |||||
}) | }) | ||||
if err != nil { | |||||
log.Error("ListParts failed:", err.Error()) | |||||
return err | |||||
} | |||||
partNumberMarker = output.NextPartNumberMarker | |||||
log.Info("uuid:%s, MaxParts:%d, PartNumberMarker:%d, NextPartNumberMarker:%d, len:%d", uuid, output.MaxParts, output.PartNumberMarker, output.NextPartNumberMarker, len(output.Parts)) | |||||
for _, partInfo := range output.Parts { | |||||
input.Parts = append(input.Parts, obs.Part{ | |||||
PartNumber: partInfo.PartNumber, | |||||
ETag: partInfo.ETag, | |||||
}) | |||||
} | |||||
if len(output.Parts) < output.MaxParts { | |||||
break | |||||
} else { | |||||
continue | |||||
} | |||||
break | |||||
} | } | ||||
_, err = ObsCli.CompleteMultipartUpload(input) | |||||
output, err := ObsCli.CompleteMultipartUpload(input) | |||||
if err != nil { | if err != nil { | ||||
log.Error("CompleteMultipartUpload failed:", err.Error()) | log.Error("CompleteMultipartUpload failed:", err.Error()) | ||||
return err | return err | ||||
} | } | ||||
log.Info("uuid:%s, RequestId:%s", uuid, output.RequestId) | |||||
return nil | return nil | ||||
} | } | ||||
@@ -26,7 +26,7 @@ import qs from 'qs'; | |||||
import createDropzone from '../features/dropzone.js'; | import createDropzone from '../features/dropzone.js'; | ||||
const {_AppSubUrl, _StaticUrlPrefix, csrf} = window.config; | const {_AppSubUrl, _StaticUrlPrefix, csrf} = window.config; | ||||
// const uploadtype = 0; | |||||
const chunkSize = 1024 * 1024 * 64; | |||||
export default { | export default { | ||||
props:{ | props:{ | ||||
@@ -137,7 +137,6 @@ export default { | |||||
resetStatus() { | resetStatus() { | ||||
this.progress = 0; | this.progress = 0; | ||||
this.status = ''; | this.status = ''; | ||||
console.log(this.uploadtype) | |||||
}, | }, | ||||
updateProgress(file, progress) { | updateProgress(file, progress) { | ||||
console.log("progress---",progress) | console.log("progress---",progress) | ||||
@@ -165,7 +164,6 @@ export default { | |||||
.getElementById('datasetId') | .getElementById('datasetId') | ||||
.getAttribute('datasetId'); | .getAttribute('datasetId'); | ||||
this.resetStatus(); | this.resetStatus(); | ||||
console.log(this.file,!this.file?.upload) | |||||
if(!this.file?.upload){ | if(!this.file?.upload){ | ||||
this.btnFlag = false | this.btnFlag = false | ||||
return | return | ||||
@@ -186,7 +184,6 @@ export default { | |||||
File.prototype.slice || | File.prototype.slice || | ||||
File.prototype.mozSlice || | File.prototype.mozSlice || | ||||
File.prototype.webkitSlice, | File.prototype.webkitSlice, | ||||
chunkSize = 1024 * 1024 * 64, | |||||
chunks = Math.ceil(file.size / chunkSize), | chunks = Math.ceil(file.size / chunkSize), | ||||
spark = new SparkMD5.ArrayBuffer(), | spark = new SparkMD5.ArrayBuffer(), | ||||
fileReader = new FileReader(); | fileReader = new FileReader(); | ||||
@@ -327,7 +324,6 @@ export default { | |||||
}, | }, | ||||
async newMultiUpload(file) { | async newMultiUpload(file) { | ||||
console.log(this.uploadtype,this) | |||||
const res = await axios.get('/attachments/new_multipart', { | const res = await axios.get('/attachments/new_multipart', { | ||||
params: { | params: { | ||||
totalChunkCounts: file.totalChunkCounts, | totalChunkCounts: file.totalChunkCounts, | ||||
@@ -348,7 +344,6 @@ export default { | |||||
File.prototype.slice || | File.prototype.slice || | ||||
File.prototype.mozSlice || | File.prototype.mozSlice || | ||||
File.prototype.webkitSlice, | File.prototype.webkitSlice, | ||||
chunkSize = 1024 * 1024 * 32, | |||||
chunks = Math.ceil(file.size / chunkSize), | chunks = Math.ceil(file.size / chunkSize), | ||||
fileReader = new FileReader(), | fileReader = new FileReader(), | ||||
time = new Date().getTime(); | time = new Date().getTime(); | ||||
@@ -457,7 +452,6 @@ export default { | |||||
} | } | ||||
async function completeUpload() { | async function completeUpload() { | ||||
console.log(_this.uploadtype) | |||||
return await axios.post( | return await axios.post( | ||||
'/attachments/complete_multipart', | '/attachments/complete_multipart', | ||||
qs.stringify({ | qs.stringify({ | ||||
@@ -494,7 +488,6 @@ export default { | |||||
1}/${chunks}个分片上传` | 1}/${chunks}个分片上传` | ||||
); | ); | ||||
this.progress = Math.ceil((currentChunk / chunks) * 100); | this.progress = Math.ceil((currentChunk / chunks) * 100); | ||||
console.log("((currentChunk / chunks) * 100).toFixed(2)",((currentChunk / chunks) * 100).toFixed(2)) | |||||
this.updateProgress(file, ((currentChunk / chunks) * 100).toFixed(2)); | this.updateProgress(file, ((currentChunk / chunks) * 100).toFixed(2)); | ||||
this.status = `${this.dropzoneParams.data('uploading')} ${( | this.status = `${this.dropzoneParams.data('uploading')} ${( | ||||
(currentChunk / chunks) * | (currentChunk / chunks) * | ||||
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》