feat(downloads): default to latest version when URL lacks modelVersionId

Auto-select the first (newest) version for URLs without an explicit
modelVersionId, matching the existing batch flow, so users can proceed
to location/download without manually picking a version.
This commit is contained in:
Will Miao
2026-08-07 11:24:45 +08:00
parent d9ab92602a
commit 7ea6df4111
2 changed files with 270 additions and 0 deletions

View File

@@ -235,6 +235,9 @@ export class DownloadManager {
if (this.modelVersionId) {
this.currentVersion = this.versions.find(v => v.id.toString() === this.modelVersionId);
} else {
// No explicit version id in the URL → default to the latest version (Civitai returns newest first)
this.currentVersion = this.versions[0];
}
this.showVersionStep();
@@ -428,6 +431,9 @@ export class DownloadManager {
await this.retrieveVersionsForModel(this.modelId, this.source);
if (this.modelVersionId) {
this.currentVersion = this.versions.find(v => v.id.toString() === this.modelVersionId);
} else {
// No explicit version id → default to the latest version (Civitai returns newest first)
this.currentVersion = this.versions[0];
}
this.showVersionStep();
} catch (error) {