fix: batch URL download dedup by modelId+modelVersionId composite key (#936)

When batch-downloading different versions of the same model, dedup by
modelId alone discards the second URL. Use modelId:modelVersionId as
the dedup key so users can download, e.g., latest + a specific version.
This commit is contained in:
Will Miao
2026-06-09 07:02:56 +08:00
parent 23c6863a3a
commit 130fb5d2d5

View File

@@ -218,8 +218,13 @@ export class DownloadManager {
parsed.push({ url, error: translate('modals.download.errors.invalidUrl') });
continue;
}
if (seen.has(result.modelId)) continue;
seen.add(result.modelId);
// Dedup by modelId + modelVersionId combo so users can download
// different versions of the same model (e.g. latest + a specific version)
const dedupKey = result.modelVersionId
? `${result.modelId}:${result.modelVersionId}`
: result.modelId;
if (seen.has(dedupKey)) continue;
seen.add(dedupKey);
parsed.push({ url, ...result, error: null });
}