feat(download): download to current version's directory in versions tab

Instead of always using default paths, downloads from the model versions
tab now target the same directory as the current in-library version.
Falls back silently to default paths if the current version path cannot
be resolved.
This commit is contained in:
Will Miao
2026-02-22 15:55:04 +08:00
parent 0b48654ae6
commit a0cf78842e
2 changed files with 63 additions and 4 deletions

View File

@@ -620,7 +620,12 @@ export class DownloadManager {
});
}
async downloadVersionWithDefaults(modelType, modelId, versionId, { versionName = '', source = null } = {}) {
async downloadVersionWithDefaults(modelType, modelId, versionId, {
versionName = '',
source = null,
modelRoot = '',
targetFolder = ''
} = {}) {
try {
this.apiClient = getModelApiClient(modelType);
} catch (error) {
@@ -630,13 +635,14 @@ export class DownloadManager {
this.modelId = modelId ? modelId.toString() : null;
this.source = source;
const useDefaultPaths = !modelRoot;
return this.executeDownloadWithProgress({
modelId,
versionId,
versionName,
modelRoot: '',
targetFolder: '',
useDefaultPaths: true,
modelRoot: modelRoot || '',
targetFolder: targetFolder || '',
useDefaultPaths,
source,
closeModal: false,
});