fix(import): discover LoRA + checkpoint from modelVersionIds when API meta is null

When CivitAI image API returns meta=null and modelVersionIds at root
level, the import flow now:

- Injects modelVersionIds + browsingLevel into a minimal metadata dict
  so the parser can discover LoRAs and checkpoints (both import-from-url
  and analyze-image paths)
- Adds checkpoint dedup + fallback in the parser's modelVersionIds
  handler to avoid duplicate API calls
- Runs EXIF extraction unconditionally in analyze-image path, then
  merges with API metadata (fixes gen params loss)
- Propagates preview_nsfw_level through all three import paths:
  import-from-url, analyze-image (UI Import), and batch-import,
  plus the frontend save flow
This commit is contained in:
Will Miao
2026-06-27 17:05:38 +08:00
parent 20417797e8
commit 283730cf38
5 changed files with 186 additions and 21 deletions

View File

@@ -57,9 +57,16 @@ export class DownloadManager {
base_model: this.importManager.recipeData.base_model || "",
loras: this.importManager.recipeData.loras || [],
gen_params: this.importManager.recipeData.gen_params || {},
raw_metadata: this.importManager.recipeData.raw_metadata || {}
raw_metadata: this.importManager.recipeData.raw_metadata || {},
};
// Preserve preview_nsfw_level from analysis so the saved
// recipe applies the correct NSFW blur on the preview image.
const nsfwLevel = this.importManager.recipeData.preview_nsfw_level;
if (nsfwLevel !== undefined && nsfwLevel !== null) {
completeMetadata.preview_nsfw_level = nsfwLevel;
}
const checkpointMetadata =
this.importManager.recipeData.checkpoint ||
this.importManager.recipeData.model ||