From 4bf5dc6feff73f075c2c6bd5382372a642b3c2eb Mon Sep 17 00:00:00 2001 From: fszontagh Date: Mon, 27 Jul 2026 10:58:57 +0200 Subject: [PATCH] feat: expose IP-Adapter in server request schema and capabilities --- examples/common/common.cpp | 6 ++++++ examples/server/api.md | 9 ++++++++- examples/server/routes_sdcpp.cpp | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/examples/common/common.cpp b/examples/common/common.cpp index 82558e7c2..d2ddca9f6 100644 --- a/examples/common/common.cpp +++ b/examples/common/common.cpp @@ -1901,6 +1901,7 @@ bool SDGenerationParams::from_json_str( load_if_exists("strength", strength); load_if_exists("control_strength", control_strength); + load_if_exists("ip_adapter_strength", ip_adapter_strength); load_if_exists("moe_boundary", moe_boundary); load_if_exists("vace_strength", vace_strength); @@ -2072,6 +2073,10 @@ bool SDGenerationParams::from_json_str( LOG_ERROR("invalid control_image"); return false; } + if (!parse_image_json_field(j, "ip_adapter_image", 3, width, height, ip_adapter_image)) { + LOG_ERROR("invalid ip_adapter_image"); + return false; + } return true; } @@ -2807,6 +2812,7 @@ std::string build_sdcpp_image_metadata_json(const SDContextParams& ctx_params, root["clip_skip"] = gen_params.clip_skip; root["strength"] = gen_params.strength; root["control_strength"] = gen_params.control_strength; + root["ip_adapter_strength"] = gen_params.ip_adapter_strength; root["auto_resize_ref_image"] = gen_params.auto_resize_ref_image; root["increase_ref_index"] = gen_params.increase_ref_index; if (mode == VID_GEN) { diff --git a/examples/server/api.md b/examples/server/api.md index adcec26ff..29d65877e 100644 --- a/examples/server/api.md +++ b/examples/server/api.md @@ -528,6 +528,7 @@ Shared default fields used by both `img_gen` and `vid_gen`: | `auto_resize_ref_image` | `boolean` | | `increase_ref_index` | `boolean` | | `control_strength` | `number` | +| `ip_adapter_strength` | `number` | | `hires` | `object` | | `hires.enabled` | `boolean` | | `hires.upscaler` | `string` | @@ -567,6 +568,7 @@ Fields returned in `features_by_mode.img_gen`: - `init_image` - `mask_image` - `control_image` +- `ip_adapter_image` - `ref_images` - `lora` - `vae_tiling` @@ -653,12 +655,14 @@ Example: "auto_resize_ref_image": true, "increase_ref_index": false, "control_strength": 0.9, + "ip_adapter_strength": 1.0, "embed_image_metadata": true, "init_image": null, "ref_images": [], "mask_image": null, "control_image": null, + "ip_adapter_image": null, "sample_params": { "scheduler": "discrete", @@ -733,6 +737,7 @@ Channel expectations: - `init_image`: 3 channels - `ref_images[]`: 3 channels - `control_image`: 3 channels +- `ip_adapter_image`: 3 channels - `mask_image`: 1 channel If omitted or null: @@ -757,6 +762,7 @@ Top-level scalar fields: | `auto_resize_ref_image` | `boolean` | | `increase_ref_index` | `boolean` | | `control_strength` | `number` | +| `ip_adapter_strength` | `number` | | `embed_image_metadata` | `boolean` | Image fields: @@ -767,6 +773,7 @@ Image fields: | `ref_images` | `array` | | `mask_image` | `string \| null` | | `control_image` | `string \| null` | +| `ip_adapter_image` | `string \| null` | LoRA fields: @@ -958,7 +965,7 @@ Response fields: Compared with `img_gen`, the `vid_gen` request body: - `vid_gen` is a single video sequence job, so `batch_count` is not part of the request schema -- `ref_images`, `mask_image`, `control_image`, `control_strength`, and `embed_image_metadata` are not part of the request schema +- `ref_images`, `mask_image`, `control_image`, `control_strength`, `ip_adapter_image`, `ip_adapter_strength`, and `embed_image_metadata` are not part of the request schema - `vid_gen` adds `end_image`, `control_frames`, `high_noise_sample_params`, `video_frames`, `fps`, `moe_boundary`, and `vace_strength` Example: diff --git a/examples/server/routes_sdcpp.cpp b/examples/server/routes_sdcpp.cpp index 0d0a22e9b..7253dbf49 100644 --- a/examples/server/routes_sdcpp.cpp +++ b/examples/server/routes_sdcpp.cpp @@ -130,6 +130,7 @@ static json make_img_gen_defaults_json(const SDGenerationParams& defaults, const {"auto_resize_ref_image", defaults.auto_resize_ref_image}, {"increase_ref_index", defaults.increase_ref_index}, {"control_strength", defaults.control_strength}, + {"ip_adapter_strength", defaults.ip_adapter_strength}, {"sample_params", make_sample_params_json(defaults.sample_params, defaults.skip_layers)}, {"hires", make_hires_json(defaults)}, {"vae_tiling_params", make_vae_tiling_json(defaults.vae_tiling_params)}, @@ -173,6 +174,7 @@ static json make_img_gen_features_json() { {"init_image", true}, {"mask_image", true}, {"control_image", true}, + {"ip_adapter_image", true}, {"ref_images", true}, {"lora", true}, {"vae_tiling", true},