Add preview image handling for Civitai models and enhance job processing
- Introduced the `pick_preview_image` function to extract the first usable preview image URL and its suffix from model version data. - Updated the `seed_civitai` function to include preview image URLs and destinations in job definitions, improving model handling. - Implemented the `ensure_preview` function to download missing preview images during job processing, enhancing user experience. - Added tests for `pick_preview_image` to ensure correct functionality across various scenarios, ensuring robustness in image handling.
This commit is contained in:
+24
-10
@@ -349,17 +349,31 @@ def _local_manifests(cfg: Config, checks: list[Check]) -> None:
|
||||
|
||||
try:
|
||||
repos = parse_extensions(cfg.extensions_manifest)
|
||||
if cfg.extensions_manifest.is_file():
|
||||
checks.append(
|
||||
Check(
|
||||
"extensions.yaml",
|
||||
True,
|
||||
True,
|
||||
f"{len(repos)} git-реп",
|
||||
)
|
||||
)
|
||||
else:
|
||||
if not cfg.extensions_manifest.is_file():
|
||||
checks.append(Check("extensions.yaml", True, False, "файла нет — стоковый SwarmUI"))
|
||||
elif repos:
|
||||
checks.append(Check("extensions.yaml", True, True, f"{len(repos)} git-реп"))
|
||||
else:
|
||||
example = cfg.extensions_manifest.with_name("extensions.example.yaml")
|
||||
n_ex = 0
|
||||
if example.is_file():
|
||||
try:
|
||||
n_ex = len(parse_extensions(example))
|
||||
except ConfigError:
|
||||
n_ex = 0
|
||||
if n_ex:
|
||||
checks.append(
|
||||
Check(
|
||||
"extensions.yaml",
|
||||
True,
|
||||
False,
|
||||
f"пустой; в example {n_ex} реп — скопируй и gpu-rent seed-extensions",
|
||||
)
|
||||
)
|
||||
else:
|
||||
checks.append(
|
||||
Check("extensions.yaml", True, False, "0 реп — стоковый SwarmUI")
|
||||
)
|
||||
except ConfigError as exc:
|
||||
checks.append(Check("extensions.yaml", False, True, str(exc)))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user