feat: support multiple reference images with model-aware API mapping
All checks were successful
Continuous Integration / Build Package (push) Successful in 31s
Continuous Integration / Lint, Check & Test (push) Successful in 49s

Replace singular reference_image field with reference_images list to
support an arbitrary number of reference images. Map them to the correct
BFL API parameter names based on model family:
- flux-2-*: input_image, input_image_2, ..., input_image_8
- flux-kontext-*: input_image, input_image_2, ..., input_image_4
- flux 1.x: image_prompt (single)

BREAKING CHANGE: reference_image config field renamed to reference_images (list).
This commit is contained in:
Konstantin Fickel 2026-02-14 17:19:54 +01:00
parent b69c38ac13
commit d565329e16
Signed by: kfickel
GPG key ID: A793722F9933C1A5
8 changed files with 112 additions and 23 deletions

View file

@ -51,8 +51,7 @@ def _collect_dep_files(
"""Collect all dependency file paths for a target."""
target_cfg = config.targets[target_name]
deps: list[str] = list(target_cfg.inputs)
if target_cfg.reference_image is not None:
deps.append(target_cfg.reference_image)
deps.extend(target_cfg.reference_images)
deps.extend(target_cfg.control_images)
return [project_dir / d for d in deps]
@ -65,19 +64,18 @@ def _collect_extra_params(target_name: str, config: ProjectConfig) -> dict[str,
params["width"] = target_cfg.width
if target_cfg.height is not None:
params["height"] = target_cfg.height
if target_cfg.reference_image is not None:
params["reference_image"] = target_cfg.reference_image
if target_cfg.reference_images:
params["reference_images"] = tuple(target_cfg.reference_images)
if target_cfg.control_images:
params["control_images"] = tuple(target_cfg.control_images)
return params
def _collect_all_deps(target_name: str, config: ProjectConfig) -> list[str]:
"""Collect all dependency names (inputs + reference_image + control_images)."""
"""Collect all dependency names (inputs + reference_images + control_images)."""
target_cfg = config.targets[target_name]
deps: list[str] = list(target_cfg.inputs)
if target_cfg.reference_image is not None:
deps.append(target_cfg.reference_image)
deps.extend(target_cfg.reference_images)
deps.extend(target_cfg.control_images)
return deps