fix(download): close modal before progress overlay and fix downloadId ReferenceError on cancel

This commit is contained in:
Will Miao
2026-07-13 11:29:47 +08:00
parent 774cc1be86
commit bab9752c8b

View File

@@ -882,13 +882,12 @@ export class DownloadManager {
let ws = null;
let updateProgress = () => { };
let cancelled = false;
const downloadId = Date.now().toString();
try {
this.loadingManager.restoreProgressBar();
updateProgress = this.loadingManager.showDownloadProgress(1);
updateProgress(0, 0, displayName);
const downloadId = Date.now().toString();
const wsProtocol = window.location.protocol === 'https:' ? 'wss://' : 'ws://';
ws = new WebSocket(`${wsProtocol}${window.location.host}/ws/download-progress?id=${downloadId}`);
@@ -1501,6 +1500,8 @@ export class DownloadManager {
this.currentVersion?.id, (this.currentVersion?.files || []).length);
}
modalManager.closeModal('downloadModal');
return this.executeDownloadWithProgress({
modelId: this.modelId,
versionId: this.currentVersion.id,