refactor(injectors): consolidate boogu and qwen-2.1 into reference_image with flexible max_images
Browse filesFiles changed (17)
- chain_injectors/boogu_image_edit_injector.pyDeleted-73
- chain_injectors/qwen_image_2_1_edit_injector.pyDeleted-73
- chain_injectors/reference_image_injector.py+48-22
- core/pipelines/pipeline_input_processor.py-24
- core/pipelines/sd_image_pipeline.py-4
- core/pipelines/workflow_recipes/_partials/conditioning/boogu-image.yaml+5-5
- core/pipelines/workflow_recipes/_partials/conditioning/qwen-image-2.1.yaml+5-4
- mcp_tools/common.py+1-7
- ui/events/chain_handlers.py+1-67
- ui/events/change_handlers.py+2-6
- ui/events/main.py+3-15
- ui/events/run_handlers.py+1-5
- ui/imagegen_ui.py+1-3
- ui/shared/ui_components.py+3-61
- yaml/chain_features.yaml+2-30
- yaml/model_architecture_features.yaml+2-2
- yaml/task_features.yaml-10
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273def create_node(assembler, class_type, title):
try:
node = assembler._get_node_template(class_type)
except Exception:
node = {
"inputs": {},
"class_type": class_type,
"_meta": {"title": title}
}
node['_meta']['title'] = title
return node
def inject(assembler, chain_definition, chain_items):
if not chain_items:
return
valid_images = []
for item in chain_items:
if not item:
continue
img_path = item
if isinstance(item, dict):
img_path = item.get('image') or item.get('filename') or item.get('path')
if img_path:
valid_images.append(img_path)
if not valid_images:
return
valid_images = valid_images[:10]
boogu_prompt_name = chain_definition.get('boogu_prompt_node', 'boogu_prompt')
vae_loader_name = chain_definition.get('vae_loader_node', 'vae_loader')
boogu_prompt_id = assembler.node_map.get(boogu_prompt_name)
if not boogu_prompt_id or boogu_prompt_id not in assembler.workflow:
for node_id, node in assembler.workflow.items():
if isinstance(node, dict) and node.get('class_type') == 'TextEncodeBooguEdit':
boogu_prompt_id = node_id
break
if not boogu_prompt_id:
print(f"Warning: Target node '{boogu_prompt_name}' (TextEncodeBooguEdit) for Boogu Edit chain not found. Skipping.")
return
vae_id = assembler.node_map.get(vae_loader_name)
if not vae_id:
for node_id, node in assembler.workflow.items():
if isinstance(node, dict) and node.get('class_type') == 'VAELoader':
vae_id = node_id
break
if vae_id:
assembler.workflow[boogu_prompt_id]['inputs']['vae'] = [vae_id, 0]
for i, img_filename in enumerate(valid_images):
load_id = assembler._get_unique_id()
load_node = create_node(assembler, "LoadImage", f"Load Reference Image {i+1}")
load_node['inputs']['image'] = img_filename
assembler.workflow[load_id] = load_node
scale_id = assembler._get_unique_id()
scale_node = create_node(assembler, "ImageScaleToTotalPixels", f"Scale Reference {i+1}")
scale_node['inputs']['upscale_method'] = "nearest-exact"
scale_node['inputs']['megapixels'] = 1
scale_node['inputs']['resolution_steps'] = 1
scale_node['inputs']['image'] = [load_id, 0]
assembler.workflow[scale_id] = scale_node
image_key = f"images.image_{i+1}"
assembler.workflow[boogu_prompt_id]['inputs'][image_key] = [scale_id, 0]
print(f"Boogu Edit injector applied with {len(valid_images)} reference image(s). Connected VAE dynamically.")12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273def create_node(assembler, class_type, title): try: node = assembler._get_node_template(class_type) except Exception: node = { "inputs": {}, "class_type": class_type, "_meta": {"title": title} } node['_meta']['title'] = title return node
def inject(assembler, chain_definition, chain_items): if not chain_items: return
valid_images = [] for item in chain_items: if not item: continue img_path = item if isinstance(item, dict): img_path = item.get('image') or item.get('filename') or item.get('path') if img_path: valid_images.append(img_path)
if not valid_images: return
valid_images = valid_images[:10]
prompt_name = chain_definition.get('prompt_node', 'prompt') vae_loader_name = chain_definition.get('vae_loader_node', 'vae_loader')
prompt_id = assembler.node_map.get(prompt_name) if not prompt_id or prompt_id not in assembler.workflow: for node_id, node in assembler.workflow.items(): if isinstance(node, dict) and node.get('class_type') == 'TextEncodeQwenImage21': prompt_id = node_id break
if not prompt_id: print(f"Warning: Target node '{prompt_name}' (TextEncodeQwenImage21) for Qwen-Image-2.1 Edit chain not found. Skipping.") return
vae_id = assembler.node_map.get(vae_loader_name) if not vae_id: for node_id, node in assembler.workflow.items(): if isinstance(node, dict) and node.get('class_type') == 'VAELoader': vae_id = node_id break
if vae_id: assembler.workflow[prompt_id]['inputs']['vae'] = [vae_id, 0]
for i, img_filename in enumerate(valid_images): load_id = assembler._get_unique_id() load_node = create_node(assembler, "LoadImage", f"Load Reference Image {i+1}") load_node['inputs']['image'] = img_filename assembler.workflow[load_id] = load_node
scale_id = assembler._get_unique_id() scale_node = create_node(assembler, "ImageScaleToTotalPixels", f"Scale Reference {i+1}") scale_node['inputs']['upscale_method'] = "nearest-exact" scale_node['inputs']['megapixels'] = 1 scale_node['inputs']['resolution_steps'] = 1 scale_node['inputs']['image'] = [load_id, 0] assembler.workflow[scale_id] = scale_node
image_key = f"images.image_{i+1}" assembler.workflow[prompt_id]['inputs'][image_key] = [scale_id, 0]
print(f"Qwen-Image-2.1 Edit injector applied with {len(valid_images)} reference image(s). Connected VAE dynamically.")123412 unmodified lines171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364import osdef inject(assembler, chain_definition, chain_items):if not chain_items:12 unmodified linesif not valid_images:returntext_encode_name = chain_definition.get('text_encode_node')text_encode_id = Noneif text_encode_name and text_encode_name in assembler.node_map:text_encode_id = assembler.node_map[text_encode_name]else:for node_id, node in assembler.workflow.items():if isinstance(node, dict) and node.get('class_type') == 'TextEncodeMageFlowEdit':text_encode_id = node_idbreakif not text_encode_id or text_encode_id not in assembler.workflow:print("Warning: TextEncodeMageFlowEdit node not found for Reference Image chain. Skipping.")returnvae_node_name = chain_definition.get('vae_node', 'vae_loader')vae_node_id = assembler.node_map.get(vae_node_name)if not vae_node_id:for node_id, node in assembler.workflow.items():if isinstance(node, dict) and node.get('class_type') == 'VAELoader':vae_node_id = node_idbreakif vae_node_id:assembler.workflow[text_encode_id]['inputs']['vae'] = [vae_node_id, 0]for i, img_filename in enumerate(valid_images):load_id = assembler._get_unique_id()load_node = assembler._get_node_template("LoadImage")load_node['inputs']['image'] = img_filenameload_node['_meta']['title'] = f"Load Reference Image {i+1}"assembler.workflow[load_id] = load_nodescale_id = assembler._get_unique_id()scale_node = assembler._get_node_template("ImageScaleToTotalPixels")scale_node['inputs']['megapixels'] = 1.0scale_node['inputs']['upscale_method'] = "nearest-exact"scale_node['inputs']['resolution_steps'] = 1scale_node['inputs']['image'] = [load_id, 0]scale_node['_meta']['title'] = f"Scale Reference {i+1}"assembler.workflow[scale_id] = scale_nodeinput_key = f"images.image_{i+1}"assembler.workflow[text_encode_id]['inputs'][input_key] = [scale_id, 0]print(f"Reference Image injector applied. Injected {len(valid_images)} reference images to TextEncodeMageFlowEdit node '{text_encode_id}'.")1234567891011121314151612 unmodified lines2930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990def create_node(assembler, class_type, title):try:node = assembler._get_node_template(class_type)except Exception:node = {"inputs": {},"class_type": class_type,"_meta": {"title": title}}if "_meta" not in node:node["_meta"] = {}node['_meta']['title'] = titlereturn nodedef inject(assembler, chain_definition, chain_items):if not chain_items:12 unmodified linesif not valid_images:returnmax_images = chain_definition.get('max_images', 10)if isinstance(max_images, int) and max_images > 0:valid_images = valid_images[:max_images]# Target prompt/text_encode node resolutiontarget_node_name = (chain_definition.get('text_encode_node')or chain_definition.get('prompt_node')or chain_definition.get('boogu_prompt_node')or 'prompt')target_node_id = assembler.node_map.get(target_node_name)if not target_node_id or target_node_id not in assembler.workflow:supported_types = ('TextEncodeMageFlowEdit', 'TextEncodeQwenImage21', 'TextEncodeBooguEdit')for node_id, node in assembler.workflow.items():if isinstance(node, dict) and node.get('class_type') in supported_types:target_node_id = node_idbreakif not target_node_id or target_node_id not in assembler.workflow:print(f"Warning: Target text encode node '{target_node_name}' for Reference Image chain not found. Skipping.")return# VAE loader node resolutionvae_node_name = chain_definition.get('vae_node') or chain_definition.get('vae_loader_node', 'vae_loader')vae_node_id = assembler.node_map.get(vae_node_name)if not vae_node_id or vae_node_id not in assembler.workflow:for node_id, node in assembler.workflow.items():if isinstance(node, dict) and node.get('class_type') == 'VAELoader':vae_node_id = node_idbreakif vae_node_id:assembler.workflow[target_node_id]['inputs']['vae'] = [vae_node_id, 0]upscale_method = chain_definition.get('upscale_method', 'nearest-exact')megapixels = chain_definition.get('megapixels', 1.0)resolution_steps = chain_definition.get('resolution_steps', 1)for i, img_filename in enumerate(valid_images):load_id = assembler._get_unique_id()load_node = create_node(assembler, "LoadImage", f"Load Reference Image {i+1}")load_node['inputs']['image'] = img_filenameassembler.workflow[load_id] = load_nodescale_id = assembler._get_unique_id()scale_node = create_node(assembler, "ImageScaleToTotalPixels", f"Scale Reference {i+1}")scale_node['inputs']['upscale_method'] = upscale_methodscale_node['inputs']['megapixels'] = megapixelsscale_node['inputs']['resolution_steps'] = resolution_stepsscale_node['inputs']['image'] = [load_id, 0]assembler.workflow[scale_id] = scale_nodeinput_key = f"images.image_{i+1}"assembler.workflow[target_node_id]['inputs'][input_key] = [scale_id, 0]node_class = assembler.workflow[target_node_id].get('class_type', 'Unknown')print(f"Reference Image injector applied: {len(valid_images)} image(s) injected into '{target_node_id}' ({node_class}), max_images={max_images}.")
411 unmodified lines41241341441541641741841942042142242342442542642742842943043143243343443543643743843957 unmodified lines497498499500501502503504411 unmodified linestemp_files_to_clean.append(temp_path)active_qwen_image_edit.append(os.path.basename(temp_path))boogu_edit_data = ui_inputs.get('boogu_edit_data', [])active_boogu_edit = []if 'boogu_image_edit' in enabled_chains and boogu_edit_data:for img in boogu_edit_data:if img:if not os.path.exists(INPUT_DIR): os.makedirs(INPUT_DIR)temp_path = os.path.join(INPUT_DIR, f"temp_boogu_edit_ref_{random.randint(1000, 9999)}.png")img.save(temp_path, "PNG")temp_files_to_clean.append(temp_path)active_boogu_edit.append(os.path.basename(temp_path))qwen_image_2_1_edit_data = ui_inputs.get('qwen_image_2_1_edit_data', [])active_qwen_image_2_1_edit = []if 'qwen_image_2_1_edit' in enabled_chains and qwen_image_2_1_edit_data:for img in qwen_image_2_1_edit_data:if img:if not os.path.exists(INPUT_DIR): os.makedirs(INPUT_DIR)temp_path = os.path.join(INPUT_DIR, f"temp_qwen21_edit_ref_{random.randint(1000, 9999)}.png")img.save(temp_path, "PNG")temp_files_to_clean.append(temp_path)active_qwen_image_2_1_edit.append(os.path.basename(temp_path))reference_image_data = ui_inputs.get('reference_image_data', [])active_reference_images = []if 'reference_image' in enabled_chains and reference_image_data:57 unmodified lines"active_krea2_identity_edit": active_krea2_identity_edit,"active_krea2_reference_edit": active_krea2_reference_edit,"active_qwen_image_edit": active_qwen_image_edit,"active_qwen_image_2_1_edit": active_qwen_image_2_1_edit,"active_boogu_edit": active_boogu_edit,"active_reference_images": active_reference_images,"active_conditioning": active_conditioning,"temp_files_to_clean": temp_files_to_clean411 unmodified lines41241341441541641757 unmodified lines475476477478479480411 unmodified linestemp_files_to_clean.append(temp_path)active_qwen_image_edit.append(os.path.basename(temp_path))reference_image_data = ui_inputs.get('reference_image_data', [])active_reference_images = []if 'reference_image' in enabled_chains and reference_image_data:57 unmodified lines"active_krea2_identity_edit": active_krea2_identity_edit,"active_krea2_reference_edit": active_krea2_reference_edit,"active_qwen_image_edit": active_qwen_image_edit,"active_reference_images": active_reference_images,"active_conditioning": active_conditioning,"temp_files_to_clean": temp_files_to_clean
119 unmodified lines12012112212312412512612755 unmodified lines183184185186187188189190119 unmodified linesactive_krea2_identity_edit = processed.get("active_krea2_identity_edit", [])active_krea2_reference_edit = processed.get("active_krea2_reference_edit", [])active_qwen_image_edit = processed.get("active_qwen_image_edit", [])active_qwen_image_2_1_edit = processed.get("active_qwen_image_2_1_edit", [])active_boogu_edit = processed.get("active_boogu_edit", [])active_reference_images = processed.get("active_reference_images", [])active_conditioning = processed["active_conditioning"]55 unmodified lines"krea2_identity_edit_chain": active_krea2_identity_edit,"krea2_style_reference_chain": active_krea2_reference_edit,"qwen_image_edit_chain": active_qwen_image_edit,"qwen_image_2_1_edit_chain": active_qwen_image_2_1_edit,"boogu_image_edit_chain": active_boogu_edit,"reference_image_chain": active_reference_images,"vae_chain": [ui_inputs.get('vae_name')] if (ui_inputs.get('vae_name') and 'vae' in enabled_chains) else [],"hidream_o1_smoothing_chain": hidream_o1_smoothing_data,119 unmodified lines12012112212312412555 unmodified lines181182183184185186119 unmodified linesactive_krea2_identity_edit = processed.get("active_krea2_identity_edit", [])active_krea2_reference_edit = processed.get("active_krea2_reference_edit", [])active_qwen_image_edit = processed.get("active_qwen_image_edit", [])active_reference_images = processed.get("active_reference_images", [])active_conditioning = processed["active_conditioning"]55 unmodified lines"krea2_identity_edit_chain": active_krea2_identity_edit,"krea2_style_reference_chain": active_krea2_reference_edit,"qwen_image_edit_chain": active_qwen_image_edit,"reference_image_chain": active_reference_images,"vae_chain": [ui_inputs.get('vae_name')] if (ui_inputs.get('vae_name') and 'vae' in enabled_chains) else [],"hidream_o1_smoothing_chain": hidream_o1_smoothing_data,
48 unmodified lines495051525354555657585948 unmodified linesksampler_node: "ksampler"clip_source: "clip_loader:0"dynamic_boogu_image_edit_chains:boogu_image_edit_chain:ksampler_node: "ksampler"boogu_prompt_node: "boogu_prompt"vae_loader_node: "vae_loader"dynamic_pid_chains:pid_chain:48 unmodified lines495051525354555657585948 unmodified linesksampler_node: "ksampler"clip_source: "clip_loader:0"dynamic_reference_image_chains:reference_image_chain:text_encode_node: "boogu_prompt"vae_node: "vae_loader"max_images: 10dynamic_pid_chains:pid_chain:
63 unmodified lines6465666768697071727363 unmodified linespid_chain:ksampler_node: "ksampler"dynamic_qwen_image_2_1_edit_chains:qwen_image_2_1_edit_chain:prompt_node: "prompt"vae_loader_node: "vae_loader"ui_map:positive_prompt: "prompt:prompt"63 unmodified lines646566676869707172737463 unmodified linespid_chain:ksampler_node: "ksampler"dynamic_reference_image_chains:reference_image_chain:text_encode_node: "prompt"vae_node: "vae_loader"max_images: 10ui_map:positive_prompt: "prompt:prompt"
446 unmodified lines447448449450451452453229 unmodified lines6836846856866876886891 unmodified line69169269369469569669769869970056 unmodified lines757758759760761762763446 unmodified linesreference_latent_data = []reference_image_data = []joyai_reference_data = []boogu_edit_data = []qwen_image_edit_data = []hidream_o1_reference_data = []sensenova_reference_data = []229 unmodified linesimg = _parse_image_param(item.get("image"))if img:reference_latent_data.append(img)elif itype in ("reference_image", "mage_flow_reference_edit"):img = _parse_image_param(item.get("image"))if img:reference_image_data.append(img)1 unmodified lineimg = _parse_image_param(item.get("image"))if img:joyai_reference_data.append(img)elif itype in ("boogu_image_edit", "boogu_edit"):img = _parse_image_param(item.get("image"))if img:boogu_edit_data.append(img)elif itype == "qwen_image_edit":img = _parse_image_param(item.get("image"))if img:56 unmodified linesif reference_latent_data: ui_inputs["reference_latent_data"] = reference_latent_dataif reference_image_data: ui_inputs["reference_image_data"] = reference_image_dataif joyai_reference_data: ui_inputs["joyai_reference_data"] = joyai_reference_dataif boogu_edit_data: ui_inputs["boogu_edit_data"] = boogu_edit_dataif qwen_image_edit_data: ui_inputs["qwen_image_edit_data"] = qwen_image_edit_dataif hidream_o1_reference_data: ui_inputs["hidream_o1_reference_data"] = hidream_o1_reference_dataif sensenova_reference_data: ui_inputs["sensenova_reference_data"] = sensenova_reference_data446 unmodified lines447448449450451452229 unmodified lines6826836846856866876881 unmodified line69069169269369469556 unmodified lines752753754755756757446 unmodified linesreference_latent_data = []reference_image_data = []joyai_reference_data = []qwen_image_edit_data = []hidream_o1_reference_data = []sensenova_reference_data = []229 unmodified linesimg = _parse_image_param(item.get("image"))if img:reference_latent_data.append(img)elif itype in ("reference_image", "mage_flow_reference_edit", "boogu_image_edit", "boogu_edit", "qwen_image_2_1_edit"):img = _parse_image_param(item.get("image"))if img:reference_image_data.append(img)1 unmodified lineimg = _parse_image_param(item.get("image"))if img:joyai_reference_data.append(img)elif itype == "qwen_image_edit":img = _parse_image_param(item.get("image"))if img:56 unmodified linesif reference_latent_data: ui_inputs["reference_latent_data"] = reference_latent_dataif reference_image_data: ui_inputs["reference_image_data"] = reference_image_dataif joyai_reference_data: ui_inputs["joyai_reference_data"] = joyai_reference_dataif qwen_image_edit_data: ui_inputs["qwen_image_edit_data"] = qwen_image_edit_dataif hidream_o1_reference_data: ui_inputs["hidream_o1_reference_data"] = hidream_o1_reference_dataif sensenova_reference_data: ui_inputs["sensenova_reference_data"] = sensenova_reference_data
987 unmodified lines9889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057987 unmodified linesadd_outputs = [count_state, add_button, del_button] + ref_rowsdel_outputs = [count_state, add_button, del_button] + ref_rows + imagesadd_button.click(fn=add_ref_row, inputs=[count_state], outputs=add_outputs, show_progress=False)del_button.click(fn=del_ref_row, inputs=[count_state], outputs=del_outputs, show_progress=False)def create_boogu_edit_event_handlers(prefix, ui_components, max_units=10):ref_rows = ui_components.get(f'boogu_edit_rows_{prefix}')if not ref_rows: returncount_state = ui_components[f'boogu_edit_count_state_{prefix}']add_button = ui_components[f'add_boogu_edit_button_{prefix}']del_button = ui_components[f'delete_boogu_edit_button_{prefix}']images = ui_components[f'boogu_edit_images_{prefix}']def add_ref_row(c):c += 1return {count_state: c,ref_rows[c - 1]: gr.update(visible=True),add_button: gr.update(visible=c < max_units),del_button: gr.update(visible=True),}def del_ref_row(c):c -= 1return {count_state: c,ref_rows[c]: gr.update(visible=False),images[c]: None,add_button: gr.update(visible=True),del_button: gr.update(visible=c > 1),}add_outputs = [count_state, add_button, del_button] + ref_rowsdel_outputs = [count_state, add_button, del_button] + ref_rows + imagesadd_button.click(fn=add_ref_row, inputs=[count_state], outputs=add_outputs, show_progress=False)del_button.click(fn=del_ref_row, inputs=[count_state], outputs=del_outputs, show_progress=False)def create_qwen_image_2_1_edit_event_handlers(prefix, ui_components, max_units=10):ref_rows = ui_components.get(f'qwen_image_2_1_edit_rows_{prefix}')if not ref_rows: returncount_state = ui_components[f'qwen_image_2_1_edit_count_state_{prefix}']add_button = ui_components[f'add_qwen_image_2_1_edit_button_{prefix}']del_button = ui_components[f'delete_qwen_image_2_1_edit_button_{prefix}']images = ui_components[f'qwen_image_2_1_edit_images_{prefix}']def add_ref_row(c):c += 1return {count_state: c,ref_rows[c - 1]: gr.update(visible=True),add_button: gr.update(visible=c < max_units),del_button: gr.update(visible=True),}def del_ref_row(c):c -= 1return {count_state: c,ref_rows[c]: gr.update(visible=False),images[c]: None,add_button: gr.update(visible=True),del_button: gr.update(visible=c > 1),}add_outputs = [count_state, add_button, del_button] + ref_rowsdel_outputs = [count_state, add_button, del_button] + ref_rows + imagesadd_button.click(fn=add_ref_row, inputs=[count_state], outputs=add_outputs, show_progress=False)del_button.click(fn=del_ref_row, inputs=[count_state], outputs=del_outputs, show_progress=False)987 unmodified lines988989990991987 unmodified linesadd_outputs = [count_state, add_button, del_button] + ref_rowsdel_outputs = [count_state, add_button, del_button] + ref_rows + imagesadd_button.click(fn=add_ref_row, inputs=[count_state], outputs=add_outputs, show_progress=False)del_button.click(fn=del_ref_row, inputs=[count_state], outputs=del_outputs, show_progress=False)
17 unmodified lines1819202122232462 unmodified lines878889909192939464 unmodified lines15916016116216316416570 unmodified lines23623723823924024124224317 unmodified linesload_ipadapter_config)def make_update_fn(m_comp, cat_comp, ar_comp, width_comp, height_comp, cn_types, cn_series, cn_filepaths, anima_cn_types, anima_cn_series, anima_cn_filepaths, diffsynth_cn_types, diffsynth_cn_series, diffsynth_cn_filepaths, krea2_cn_types, krea2_cn_series, krea2_cn_filepaths, ipa_preset, lora_acc, cn_acc, anima_cn_acc, diffsynth_cn_acc, krea2_cn_acc, ipa_acc, sd3_ipa_acc, flux1_ipa_acc, style_acc, embed_acc, cond_acc, ref_latent_acc, hidream_o1_ref_acc, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp, pid_acc=None, vae_acc=None, joyai_ref_acc=None, krea2_identity_edit_acc=None, krea2_reference_edit_acc=None, qwen_image_edit_acc=None, qwen_image_2_1_edit_acc=None, boogu_edit_acc=None, ref_img_acc=None, sensenova_ref_acc=None, task_type=None, type_comp=None):def update_fn(*args):arch = args[0]category = args[1]62 unmodified linesif krea2_identity_edit_acc: updates[krea2_identity_edit_acc] = gr.update(visible=('krea2_identity_edit' in enabled_chains))if krea2_reference_edit_acc: updates[krea2_reference_edit_acc] = gr.update(visible=('krea2_style_reference' in enabled_chains))if qwen_image_edit_acc: updates[qwen_image_edit_acc] = gr.update(visible=('qwen_image_edit' in enabled_chains))if qwen_image_2_1_edit_acc: updates[qwen_image_2_1_edit_acc] = gr.update(visible=('qwen_image_2_1_edit' in enabled_chains))if boogu_edit_acc: updates[boogu_edit_acc] = gr.update(visible=('boogu_image_edit' in enabled_chains))if ref_img_acc: updates[ref_img_acc] = gr.update(visible=('reference_image' in enabled_chains))if pid_acc: updates[pid_acc] = gr.update(visible=('pid' in enabled_chains))if vae_acc: updates[vae_acc] = gr.update(visible=('vae' in enabled_chains))64 unmodified linesreturn update_fndef make_model_change_fn(cat_comp_ref, ar_comp, width_comp, height_comp, cn_types, cn_series, cn_filepaths, anima_cn_types, anima_cn_series, anima_cn_filepaths, diffsynth_cn_types, diffsynth_cn_series, diffsynth_cn_filepaths, krea2_cn_types, krea2_cn_series, krea2_cn_filepaths, arch_comp_ref, ipa_preset, lora_acc, cn_acc, anima_cn_acc, diffsynth_cn_acc, krea2_cn_acc, ipa_acc, sd3_ipa_acc, flux1_ipa_acc, style_acc, embed_acc, cond_acc, ref_latent_acc, hidream_o1_ref_acc, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp, pid_acc=None, vae_acc=None, joyai_ref_acc=None, krea2_identity_edit_acc=None, krea2_reference_edit_acc=None, qwen_image_edit_acc=None, qwen_image_2_1_edit_acc=None, boogu_edit_acc=None, ref_img_acc=None, sensenova_ref_acc=None, task_type=None, type_comp=None):def change_fn(*args):model_name = args[0]idx = 170 unmodified linesif krea2_identity_edit_acc: updates[krea2_identity_edit_acc] = gr.update(visible=('krea2_identity_edit' in enabled_chains))if krea2_reference_edit_acc: updates[krea2_reference_edit_acc] = gr.update(visible=('krea2_style_reference' in enabled_chains))if qwen_image_edit_acc: updates[qwen_image_edit_acc] = gr.update(visible=('qwen_image_edit' in enabled_chains))if qwen_image_2_1_edit_acc: updates[qwen_image_2_1_edit_acc] = gr.update(visible=('qwen_image_2_1_edit' in enabled_chains))if boogu_edit_acc: updates[boogu_edit_acc] = gr.update(visible=('boogu_image_edit' in enabled_chains))if ref_img_acc: updates[ref_img_acc] = gr.update(visible=('reference_image' in enabled_chains))if pid_acc: updates[pid_acc] = gr.update(visible=('pid' in enabled_chains))if vae_acc: updates[vae_acc] = gr.update(visible=('vae' in enabled_chains))17 unmodified lines1819202122232462 unmodified lines87888990919264 unmodified lines15715815916016116216370 unmodified lines23423523623723823917 unmodified linesload_ipadapter_config)def make_update_fn(m_comp, cat_comp, ar_comp, width_comp, height_comp, cn_types, cn_series, cn_filepaths, anima_cn_types, anima_cn_series, anima_cn_filepaths, diffsynth_cn_types, diffsynth_cn_series, diffsynth_cn_filepaths, krea2_cn_types, krea2_cn_series, krea2_cn_filepaths, ipa_preset, lora_acc, cn_acc, anima_cn_acc, diffsynth_cn_acc, krea2_cn_acc, ipa_acc, sd3_ipa_acc, flux1_ipa_acc, style_acc, embed_acc, cond_acc, ref_latent_acc, hidream_o1_ref_acc, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp, pid_acc=None, vae_acc=None, joyai_ref_acc=None, krea2_identity_edit_acc=None, krea2_reference_edit_acc=None, qwen_image_edit_acc=None, ref_img_acc=None, sensenova_ref_acc=None, task_type=None, type_comp=None):def update_fn(*args):arch = args[0]category = args[1]62 unmodified linesif krea2_identity_edit_acc: updates[krea2_identity_edit_acc] = gr.update(visible=('krea2_identity_edit' in enabled_chains))if krea2_reference_edit_acc: updates[krea2_reference_edit_acc] = gr.update(visible=('krea2_style_reference' in enabled_chains))if qwen_image_edit_acc: updates[qwen_image_edit_acc] = gr.update(visible=('qwen_image_edit' in enabled_chains))if ref_img_acc: updates[ref_img_acc] = gr.update(visible=('reference_image' in enabled_chains))if pid_acc: updates[pid_acc] = gr.update(visible=('pid' in enabled_chains))if vae_acc: updates[vae_acc] = gr.update(visible=('vae' in enabled_chains))64 unmodified linesreturn update_fndef make_model_change_fn(cat_comp_ref, ar_comp, width_comp, height_comp, cn_types, cn_series, cn_filepaths, anima_cn_types, anima_cn_series, anima_cn_filepaths, diffsynth_cn_types, diffsynth_cn_series, diffsynth_cn_filepaths, krea2_cn_types, krea2_cn_series, krea2_cn_filepaths, arch_comp_ref, ipa_preset, lora_acc, cn_acc, anima_cn_acc, diffsynth_cn_acc, krea2_cn_acc, ipa_acc, sd3_ipa_acc, flux1_ipa_acc, style_acc, embed_acc, cond_acc, ref_latent_acc, hidream_o1_ref_acc, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp, pid_acc=None, vae_acc=None, joyai_ref_acc=None, krea2_identity_edit_acc=None, krea2_reference_edit_acc=None, qwen_image_edit_acc=None, ref_img_acc=None, sensenova_ref_acc=None, task_type=None, type_comp=None):def change_fn(*args):model_name = args[0]idx = 170 unmodified linesif krea2_identity_edit_acc: updates[krea2_identity_edit_acc] = gr.update(visible=('krea2_identity_edit' in enabled_chains))if krea2_reference_edit_acc: updates[krea2_reference_edit_acc] = gr.update(visible=('krea2_style_reference' in enabled_chains))if qwen_image_edit_acc: updates[qwen_image_edit_acc] = gr.update(visible=('qwen_image_edit' in enabled_chains))if ref_img_acc: updates[ref_img_acc] = gr.update(visible=('reference_image' in enabled_chains))if pid_acc: updates[pid_acc] = gr.update(visible=('pid' in enabled_chains))if vae_acc: updates[vae_acc] = gr.update(visible=('vae' in enabled_chains))
17 unmodified lines181920212223242553 unmodified lines798081828384858635 unmodified lines1221231241251261271281299 unmodified lines13914014114214314414531 unmodified lines17717817918018118218318414 unmodified lines19920020120220320420518 unmodified lines22422522622722822923023163 unmodified lines29529629729829930030130231 unmodified lines33433533633733833934017 unmodified linescreate_krea2_identity_edit_event_handlers,create_krea2_reference_edit_event_handlers,create_qwen_image_edit_event_handlers,create_qwen_image_2_1_edit_event_handlers,create_boogu_edit_event_handlers,create_reference_image_event_handlers)from .change_handlers import (53 unmodified lineskrea2_identity_edit_accordion = ui_components.get(f'krea2_identity_edit_accordion_{prefix}')krea2_reference_edit_accordion = ui_components.get(f'krea2_reference_edit_accordion_{prefix}')qwen_image_edit_accordion = ui_components.get(f'qwen_image_edit_accordion_{prefix}')qwen_image_2_1_edit_accordion = ui_components.get(f'qwen_image_2_1_edit_accordion_{prefix}')boogu_edit_accordion = ui_components.get(f'boogu_edit_accordion_{prefix}')ref_img_accordion = ui_components.get(f'reference_image_accordion_{prefix}')pid_accordion = ui_components.get(f'pid_accordion_{prefix}')vae_accordion = ui_components.get(f'vae_accordion_{prefix}')35 unmodified linesif krea2_identity_edit_accordion: outputs.append(krea2_identity_edit_accordion)if krea2_reference_edit_accordion: outputs.append(krea2_reference_edit_accordion)if qwen_image_edit_accordion: outputs.append(qwen_image_edit_accordion)if qwen_image_2_1_edit_accordion: outputs.append(qwen_image_2_1_edit_accordion)if boogu_edit_accordion: outputs.append(boogu_edit_accordion)if ref_img_accordion: outputs.append(ref_img_accordion)if pid_accordion: outputs.append(pid_accordion)if vae_accordion: outputs.append(vae_accordion)9 unmodified lineskrea2_cn_types_list, krea2_cn_series_list, krea2_cn_filepaths_list,ipa_preset_list, lora_accordion, cn_accordion, anima_cn_accordion, diffsynth_cn_accordion, krea2_cn_accordion, ipa_accordion, sd3_ipa_accordion, flux1_ipa_accordion, style_accordion, embedding_accordion, conditioning_accordion,ref_latent_accordion, hidream_o1_ref_accordion, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp,pid_acc=pid_accordion, vae_acc=vae_accordion, joyai_ref_acc=joyai_ref_accordion, krea2_identity_edit_acc=krea2_identity_edit_accordion, krea2_reference_edit_acc=krea2_reference_edit_accordion, qwen_image_edit_acc=qwen_image_edit_accordion, qwen_image_2_1_edit_acc=qwen_image_2_1_edit_accordion, boogu_edit_acc=boogu_edit_accordion, ref_img_acc=ref_img_accordion, sensenova_ref_acc=sensenova_ref_accordion,task_type=task_type, type_comp=type_comp)inputs = [arch_comp, cat_comp]31 unmodified linesif krea2_identity_edit_accordion: outputs2.append(krea2_identity_edit_accordion)if krea2_reference_edit_accordion: outputs2.append(krea2_reference_edit_accordion)if qwen_image_edit_accordion: outputs2.append(qwen_image_edit_accordion)if qwen_image_2_1_edit_accordion: outputs2.append(qwen_image_2_1_edit_accordion)if boogu_edit_accordion: outputs2.append(boogu_edit_accordion)if ref_img_accordion: outputs2.append(ref_img_accordion)if pid_accordion: outputs2.append(pid_accordion)if vae_accordion: outputs2.append(vae_accordion)14 unmodified lineskrea2_cn_types_list, krea2_cn_series_list, krea2_cn_filepaths_list,arch_comp, ipa_preset_list, lora_accordion, cn_accordion, anima_cn_accordion, diffsynth_cn_accordion, krea2_cn_accordion, ipa_accordion, sd3_ipa_accordion, flux1_ipa_accordion, style_accordion, embedding_accordion, conditioning_accordion,ref_latent_accordion, hidream_o1_ref_accordion, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp,pid_acc=pid_accordion, vae_acc=vae_accordion, joyai_ref_acc=joyai_ref_accordion, krea2_identity_edit_acc=krea2_identity_edit_accordion, krea2_reference_edit_acc=krea2_reference_edit_accordion, qwen_image_edit_acc=qwen_image_edit_accordion, qwen_image_2_1_edit_acc=qwen_image_2_1_edit_accordion, boogu_edit_acc=boogu_edit_accordion, ref_img_acc=ref_img_accordion, sensenova_ref_acc=sensenova_ref_accordion,task_type=task_type, type_comp=type_comp)if type_comp:18 unmodified linescreate_krea2_identity_edit_event_handlers(prefix, ui_components)create_krea2_reference_edit_event_handlers(prefix, ui_components)create_qwen_image_edit_event_handlers(prefix, ui_components)create_qwen_image_2_1_edit_event_handlers(prefix, ui_components)create_boogu_edit_event_handlers(prefix, ui_components)create_reference_image_event_handlers(prefix, ui_components)create_run_event(prefix, task_type, ui_components)63 unmodified linesf'krea2_identity_edit_accordion_{prefix}': 'krea2_identity_edit',f'krea2_reference_edit_accordion_{prefix}': 'krea2_style_reference',f'qwen_image_edit_accordion_{prefix}': 'qwen_image_edit',f'qwen_image_2_1_edit_accordion_{prefix}': 'qwen_image_2_1_edit',f'boogu_edit_accordion_{prefix}': 'boogu_image_edit',f'reference_image_accordion_{prefix}': 'reference_image',f'pid_accordion_{prefix}': 'pid',f'vae_accordion_{prefix}': 'vae',31 unmodified lines'conditioning_accordion_imagegen', 'reference_latent_accordion_imagegen','hidream_o1_reference_accordion_imagegen', 'sensenova_reference_accordion_imagegen', 'joyai_reference_accordion_imagegen','krea2_identity_edit_accordion_imagegen', 'krea2_reference_edit_accordion_imagegen','qwen_image_edit_accordion_imagegen', 'qwen_image_2_1_edit_accordion_imagegen', 'boogu_edit_accordion_imagegen','reference_image_accordion_imagegen', 'pid_accordion_imagegen', 'vae_accordion_imagegen',]for key in accordion_keys:17 unmodified lines18192021222353 unmodified lines77787980818235 unmodified lines1181191201211221239 unmodified lines13313413513613713813931 unmodified lines17117217317417517614 unmodified lines19119219319419519619718 unmodified lines21621721821922022163 unmodified lines28528628728828929031 unmodified lines32232332432532632732817 unmodified linescreate_krea2_identity_edit_event_handlers,create_krea2_reference_edit_event_handlers,create_qwen_image_edit_event_handlers,create_reference_image_event_handlers)from .change_handlers import (53 unmodified lineskrea2_identity_edit_accordion = ui_components.get(f'krea2_identity_edit_accordion_{prefix}')krea2_reference_edit_accordion = ui_components.get(f'krea2_reference_edit_accordion_{prefix}')qwen_image_edit_accordion = ui_components.get(f'qwen_image_edit_accordion_{prefix}')ref_img_accordion = ui_components.get(f'reference_image_accordion_{prefix}')pid_accordion = ui_components.get(f'pid_accordion_{prefix}')vae_accordion = ui_components.get(f'vae_accordion_{prefix}')35 unmodified linesif krea2_identity_edit_accordion: outputs.append(krea2_identity_edit_accordion)if krea2_reference_edit_accordion: outputs.append(krea2_reference_edit_accordion)if qwen_image_edit_accordion: outputs.append(qwen_image_edit_accordion)if ref_img_accordion: outputs.append(ref_img_accordion)if pid_accordion: outputs.append(pid_accordion)if vae_accordion: outputs.append(vae_accordion)9 unmodified lineskrea2_cn_types_list, krea2_cn_series_list, krea2_cn_filepaths_list,ipa_preset_list, lora_accordion, cn_accordion, anima_cn_accordion, diffsynth_cn_accordion, krea2_cn_accordion, ipa_accordion, sd3_ipa_accordion, flux1_ipa_accordion, style_accordion, embedding_accordion, conditioning_accordion,ref_latent_accordion, hidream_o1_ref_accordion, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp,pid_acc=pid_accordion, vae_acc=vae_accordion, joyai_ref_acc=joyai_ref_accordion, krea2_identity_edit_acc=krea2_identity_edit_accordion, krea2_reference_edit_acc=krea2_reference_edit_accordion, qwen_image_edit_acc=qwen_image_edit_accordion, ref_img_acc=ref_img_accordion, sensenova_ref_acc=sensenova_ref_accordion,task_type=task_type, type_comp=type_comp)inputs = [arch_comp, cat_comp]31 unmodified linesif krea2_identity_edit_accordion: outputs2.append(krea2_identity_edit_accordion)if krea2_reference_edit_accordion: outputs2.append(krea2_reference_edit_accordion)if qwen_image_edit_accordion: outputs2.append(qwen_image_edit_accordion)if ref_img_accordion: outputs2.append(ref_img_accordion)if pid_accordion: outputs2.append(pid_accordion)if vae_accordion: outputs2.append(vae_accordion)14 unmodified lineskrea2_cn_types_list, krea2_cn_series_list, krea2_cn_filepaths_list,arch_comp, ipa_preset_list, lora_accordion, cn_accordion, anima_cn_accordion, diffsynth_cn_accordion, krea2_cn_accordion, ipa_accordion, sd3_ipa_accordion, flux1_ipa_accordion, style_accordion, embedding_accordion, conditioning_accordion,ref_latent_accordion, hidream_o1_ref_accordion, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp,pid_acc=pid_accordion, vae_acc=vae_accordion, joyai_ref_acc=joyai_ref_accordion, krea2_identity_edit_acc=krea2_identity_edit_accordion, krea2_reference_edit_acc=krea2_reference_edit_accordion, qwen_image_edit_acc=qwen_image_edit_accordion, ref_img_acc=ref_img_accordion, sensenova_ref_acc=sensenova_ref_accordion,task_type=task_type, type_comp=type_comp)if type_comp:18 unmodified linescreate_krea2_identity_edit_event_handlers(prefix, ui_components)create_krea2_reference_edit_event_handlers(prefix, ui_components)create_qwen_image_edit_event_handlers(prefix, ui_components)create_reference_image_event_handlers(prefix, ui_components)create_run_event(prefix, task_type, ui_components)63 unmodified linesf'krea2_identity_edit_accordion_{prefix}': 'krea2_identity_edit',f'krea2_reference_edit_accordion_{prefix}': 'krea2_style_reference',f'qwen_image_edit_accordion_{prefix}': 'qwen_image_edit',f'reference_image_accordion_{prefix}': 'reference_image',f'pid_accordion_{prefix}': 'pid',f'vae_accordion_{prefix}': 'vae',31 unmodified lines'conditioning_accordion_imagegen', 'reference_latent_accordion_imagegen','hidream_o1_reference_accordion_imagegen', 'sensenova_reference_accordion_imagegen', 'joyai_reference_accordion_imagegen','krea2_identity_edit_accordion_imagegen', 'krea2_reference_edit_accordion_imagegen','qwen_image_edit_accordion_imagegen','reference_image_accordion_imagegen', 'pid_accordion_imagegen', 'vae_accordion_imagegen',]for key in accordion_keys:
86 unmodified lines87888990919293945 unmodified lines10010110210310410510628 unmodified lines13513613713813914014114286 unmodified lineskrea2_identity_edit_data_components = ui_components.get(f'all_krea2_identity_edit_components_flat_{prefix}', [])krea2_reference_edit_data_components = ui_components.get(f'all_krea2_reference_edit_components_flat_{prefix}', [])qwen_image_edit_data_components = ui_components.get(f'all_qwen_image_edit_components_flat_{prefix}', [])qwen_image_2_1_edit_data_components = ui_components.get(f'all_qwen_image_2_1_edit_components_flat_{prefix}', [])boogu_edit_data_components = ui_components.get(f'all_boogu_edit_components_flat_{prefix}', [])reference_image_data_components = ui_components.get(f'all_reference_image_components_flat_{prefix}', [])run_inputs_map['vae_source'] = ui_components.get(f'vae_source_{prefix}')5 unmodified linesall_chains = [lora_data_components, controlnet_data_components, anima_controlnet_lllite_data_components, diffsynth_controlnet_data_components, krea2_controlnet_data_components, ipadapter_data_components,sd3_ipadapter_data_components, flux1_ipadapter_data_components, style_data_components,embedding_data_components, conditioning_data_components, reference_latent_data_components, hidream_o1_reference_data_components, sensenova_reference_data_components, joyai_reference_data_components, krea2_identity_edit_data_components, krea2_reference_edit_data_components, qwen_image_edit_data_components, qwen_image_2_1_edit_data_components, boogu_edit_data_components, reference_image_data_components]for chain in all_chains:if chain:28 unmodified linesassign_chain_data('krea2_identity_edit_data', krea2_identity_edit_data_components)assign_chain_data('krea2_reference_edit_data', krea2_reference_edit_data_components)assign_chain_data('qwen_image_edit_data', qwen_image_edit_data_components)assign_chain_data('qwen_image_2_1_edit_data', qwen_image_2_1_edit_data_components)assign_chain_data('boogu_edit_data', boogu_edit_data_components)assign_chain_data('reference_image_data', reference_image_data_components)if 'ui_type' in ui_dict:86 unmodified lines8788899091925 unmodified lines989910010110210310428 unmodified lines13313413513613713886 unmodified lineskrea2_identity_edit_data_components = ui_components.get(f'all_krea2_identity_edit_components_flat_{prefix}', [])krea2_reference_edit_data_components = ui_components.get(f'all_krea2_reference_edit_components_flat_{prefix}', [])qwen_image_edit_data_components = ui_components.get(f'all_qwen_image_edit_components_flat_{prefix}', [])reference_image_data_components = ui_components.get(f'all_reference_image_components_flat_{prefix}', [])run_inputs_map['vae_source'] = ui_components.get(f'vae_source_{prefix}')5 unmodified linesall_chains = [lora_data_components, controlnet_data_components, anima_controlnet_lllite_data_components, diffsynth_controlnet_data_components, krea2_controlnet_data_components, ipadapter_data_components,sd3_ipadapter_data_components, flux1_ipadapter_data_components, style_data_components,embedding_data_components, conditioning_data_components, reference_latent_data_components, hidream_o1_reference_data_components, sensenova_reference_data_components, joyai_reference_data_components, krea2_identity_edit_data_components, krea2_reference_edit_data_components, qwen_image_edit_data_components, reference_image_data_components]for chain in all_chains:if chain:28 unmodified linesassign_chain_data('krea2_identity_edit_data', krea2_identity_edit_data_components)assign_chain_data('krea2_reference_edit_data', krea2_reference_edit_data_components)assign_chain_data('qwen_image_edit_data', qwen_image_edit_data_components)assign_chain_data('reference_image_data', reference_image_data_components)if 'ui_type' in ui_dict:
7 unmodified lines891011121314174 unmodified lines1891901911921931941951967 unmodified linescreate_conditioning_ui, create_vae_override_ui,create_model_architecture_filter_ui, create_category_filter_ui,create_sd3_ipadapter_ui, create_flux1_ipadapter_ui, create_style_ui,create_reference_latent_ui, create_hidream_o1_reference_ui, create_sensenova_reference_ui, create_joyai_reference_ui, create_reference_image_ui, create_krea2_identity_edit_ui, create_krea2_reference_edit_ui, create_qwen_image_edit_ui, create_qwen_image_2_1_edit_ui, create_boogu_edit_ui,create_pid_ui)174 unmodified linescomponents.update(create_krea2_identity_edit_ui(prefix))components.update(create_krea2_reference_edit_ui(prefix))components.update(create_qwen_image_edit_ui(prefix))components.update(create_qwen_image_2_1_edit_ui(prefix))components.update(create_boogu_edit_ui(prefix))components.update(create_reference_image_ui(prefix))components.update(create_vae_override_ui(prefix))components.update(create_pid_ui(prefix))7 unmodified lines891011121314174 unmodified lines1891901911921931947 unmodified linescreate_conditioning_ui, create_vae_override_ui,create_model_architecture_filter_ui, create_category_filter_ui,create_sd3_ipadapter_ui, create_flux1_ipadapter_ui, create_style_ui,create_reference_latent_ui, create_hidream_o1_reference_ui, create_sensenova_reference_ui, create_joyai_reference_ui, create_reference_image_ui, create_krea2_identity_edit_ui, create_krea2_reference_edit_ui, create_qwen_image_edit_ui,create_pid_ui)174 unmodified linescomponents.update(create_krea2_identity_edit_ui(prefix))components.update(create_krea2_reference_edit_ui(prefix))components.update(create_qwen_image_edit_ui(prefix))components.update(create_reference_image_ui(prefix))components.update(create_vae_override_ui(prefix))components.update(create_pid_ui(prefix))
754 unmodified lines755756757758759760761762763118 unmodified lines882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943754 unmodified linescomponents = {}key = lambda name: f"{name}_{prefix}"with gr.Accordion("Mage-Flow Reference Edit Settings", open=False, visible=('reference_image' in default_enabled_chains)) as ref_accordion:components[key('reference_image_accordion')] = ref_accordiongr.Markdown("💡 **Tip:** (Mage-Flow-Edit-Turbo/Mage-Flow-Edit recommended) For multimodal models, this feature enables powerful editing and combining capabilities. In txt2img mode, adding a single reference image performs an **Image Edit**, while adding multiple images performs an **Image Combine**.")ref_image_groups = []ref_image_inputs = []118 unmodified linescomponents[key('all_krea2_reference_edit_components_flat')] = ref_image_inputsreturn componentsdef create_boogu_edit_ui(prefix: str, max_units=10):components = {}key = lambda name: f"{name}_{prefix}"with gr.Accordion("Boogu-Image Edit Settings", open=False, visible=('boogu_image_edit' in default_enabled_chains)) as ref_accordion:components[key('boogu_edit_accordion')] = ref_accordiongr.Markdown("💡 **Tip:** (Boogu-Image-Edit-Turbo/Boogu-Image-Edit recommended, Boogu-Image-Edit need set ZeroGPU Duration (s) to 120 ) In txt2img mode, adding a single reference image performs an **Image Edit**, while adding multiple images performs an **Image Combine**.")ref_image_groups = []ref_image_inputs = []with gr.Row():for i in range(max_units):with gr.Column(visible=(i < 1), min_width=160) as img_col:img_comp = gr.Image(type="pil", label=f"Ref. {i+1}", sources=["upload"], height=150)ref_image_groups.append(img_col)ref_image_inputs.append(img_comp)components[key('boogu_edit_rows')] = ref_image_groupscomponents[key('boogu_edit_images')] = ref_image_inputswith gr.Row():components[key('add_boogu_edit_button')] = gr.Button("✚ Add Reference Image")components[key('delete_boogu_edit_button')] = gr.Button("➖ Delete Reference Image", visible=False)components[key('boogu_edit_count_state')] = gr.State(1)components[key('all_boogu_edit_components_flat')] = ref_image_inputsreturn componentsdef create_qwen_image_2_1_edit_ui(prefix: str, max_units=10):components = {}key = lambda name: f"{name}_{prefix}"with gr.Accordion("Qwen-Image-2.1 Edit Settings", open=False, visible=('qwen_image_2_1_edit' in default_enabled_chains)) as ref_accordion:components[key('qwen_image_2_1_edit_accordion')] = ref_accordiongr.Markdown("💡 **Tip:** For Qwen-Image-2.1 models, this feature enables reference image editing and combining capabilities. In txt2img mode, adding a single reference image performs an **Image Edit**, while adding multiple images performs an **Image Combine**.")ref_image_groups = []ref_image_inputs = []with gr.Row():for i in range(max_units):with gr.Column(visible=(i < 1), min_width=160) as img_col:img_comp = gr.Image(type="pil", label=f"Ref. {i+1}", sources=["upload"], height=150)ref_image_groups.append(img_col)ref_image_inputs.append(img_comp)components[key('qwen_image_2_1_edit_rows')] = ref_image_groupscomponents[key('qwen_image_2_1_edit_images')] = ref_image_inputswith gr.Row():components[key('add_qwen_image_2_1_edit_button')] = gr.Button("✚ Add Reference Image")components[key('delete_qwen_image_2_1_edit_button')] = gr.Button("➖ Delete Reference Image", visible=False)components[key('qwen_image_2_1_edit_count_state')] = gr.State(1)components[key('all_qwen_image_2_1_edit_components_flat')] = ref_image_inputsreturn components754 unmodified lines755756757758759760761762763118 unmodified lines882883884885754 unmodified linescomponents = {}key = lambda name: f"{name}_{prefix}"with gr.Accordion("Reference Image Edit Settings", open=False, visible=('reference_image' in default_enabled_chains)) as ref_accordion:components[key('reference_image_accordion')] = ref_accordiongr.Markdown("💡 **Tip:** For multimodal models, this feature enables powerful editing and combining capabilities. In txt2img mode, adding a single reference image performs an **Image Edit**, while adding multiple images performs an **Image Combine**.")ref_image_groups = []ref_image_inputs = []118 unmodified linescomponents[key('all_krea2_reference_edit_components_flat')] = ref_image_inputsreturn components
222 unmodified lines22322422522622722822923062 unmodified lines29329429529629729829930030130230330430530630730830931031131225 unmodified lines338339340341342343344345346347348349350351352353354355356357222 unmodified linesmage_flow_reference_edit:chains: reference_imagedisplay_name: "Mage-Flow Reference Edit"description: " (Mage-Flow-Edit-Turbo/Mage-Flow-Edit recommended) For multimodal models, this feature enables powerful editing and combining capabilities. In txt2img mode, adding a single reference image performs an Image Edit, while adding multiple images performs an Image Combine."max_count: 10usage_guideline: "Supply reference image as Base64 Data URI or HTTP/HTTPS URL."parameters_schema:62 unmodified lines- series- imageboogu_image_edit:chains: boogu_image_editdisplay_name: "Boogu-Image Edit"description: " (Boogu-Image-Edit-Turbo/Boogu-Image-Edit recommended, Boogu-Image-Edit need set ZeroGPU Duration (s) to 120 ) In txt2img mode, adding a single reference image performs an Image Edit, while adding multiple images performs an Image Combine."max_count: 2usage_guideline: "Supply reference image as Base64 Data URI or HTTP/HTTPS URL."parameters_schema:type: objectproperties:image:type: stringdescription: "Reference image encoded as Base64 Data URI or HTTP/HTTPS URL."required:- imagejoyai_reference_edit:chains: joyai_image25 unmodified linesrequired:- imageqwen_image_2_1_edit:chains: qwen_image_2_1_editdisplay_name: "Qwen-Image-2.1 Edit"description: "For Qwen-Image-2.1 models, this feature enables reference image editing and combining capabilities. In txt2img mode, adding a single reference image performs an Image Edit, while adding multiple images performs an Image Combine."max_count: 10usage_guideline: "Supply reference image(s) (up to 10) encoded as Base64 Data URI or HTTP/HTTPS URL. Passing reference image(s) scales them to 1MP via nearest-exact method and feeds them dynamically into TextEncodeQwenImage21."parameters_schema:type: objectproperties:image:type: stringdescription: "Reference image encoded as Base64 Data URI or HTTP/HTTPS URL."required:- imagehidream_o1_smoothing:chains: hidream_o1_smoothing222 unmodified lines22322422522622722822923062 unmodified lines29329429529629729825 unmodified lines324325326327328329222 unmodified linesmage_flow_reference_edit:chains: reference_imagedisplay_name: "Reference Image Edit"description: "For multimodal models, this feature enables reference image editing and combining capabilities. In txt2img mode, adding a single reference image performs an Image Edit, while adding multiple images performs an Image Combine."max_count: 10usage_guideline: "Supply reference image as Base64 Data URI or HTTP/HTTPS URL."parameters_schema:62 unmodified lines- series- imagejoyai_reference_edit:chains: joyai_image25 unmodified linesrequired:- imagehidream_o1_smoothing:chains: hidream_o1_smoothing
23 unmodified lines2425262728293042 unmodified lines7374757677787923 unmodified linesboogu-image:enabled_chains:- lora- boogu_image_edit- pidpixeldit:42 unmodified linesqwen-image-2.1:enabled_chains:- lora- qwen_image_2_1_editqwen-image:enabled_chains:23 unmodified lines2425262728293042 unmodified lines7374757677787923 unmodified linesboogu-image:enabled_chains:- lora- reference_image- pidpixeldit:42 unmodified linesqwen-image-2.1:enabled_chains:- lora- reference_imageqwen-image:enabled_chains:
23 unmodified lines242526272829303119 unmodified lines515253545556575818 unmodified lines777879808182838418 unmodified lines10310410510610710810911018 unmodified lines12913013113213313413523 unmodified lines- krea2_identity_edit- krea2_style_reference- qwen_image_edit- qwen_image_2_1_edit- boogu_image_edit- reference_image- pid- vae19 unmodified lines- krea2_identity_edit- krea2_style_reference- qwen_image_edit- qwen_image_2_1_edit- boogu_image_edit- reference_image- vae18 unmodified lines- krea2_identity_edit- krea2_style_reference- qwen_image_edit- qwen_image_2_1_edit- boogu_image_edit- reference_image- vae18 unmodified lines- krea2_identity_edit- krea2_style_reference- qwen_image_edit- qwen_image_2_1_edit- boogu_image_edit- reference_image- vae18 unmodified lines- krea2_identity_edit- krea2_style_reference- qwen_image_edit- qwen_image_2_1_edit- boogu_image_edit- reference_image- vae23 unmodified lines24252627282919 unmodified lines49505152535418 unmodified lines73747576777818 unmodified lines97989910010110218 unmodified lines12112212312412523 unmodified lines- krea2_identity_edit- krea2_style_reference- qwen_image_edit- reference_image- pid- vae19 unmodified lines- krea2_identity_edit- krea2_style_reference- qwen_image_edit- reference_image- vae18 unmodified lines- krea2_identity_edit- krea2_style_reference- qwen_image_edit- reference_image- vae18 unmodified lines- krea2_identity_edit- krea2_style_reference- qwen_image_edit- reference_image- vae18 unmodified lines- krea2_identity_edit- krea2_style_reference- qwen_image_edit- reference_image- vae
chain_injectors/boogu_image_edit_injector.pyDeleted-73
chain_injectors/qwen_image_2_1_edit_injector.pyDeleted-73
chain_injectors/reference_image_injector.py+48-22
core/pipelines/pipeline_input_processor.py-24
core/pipelines/sd_image_pipeline.py-4
core/pipelines/workflow_recipes/_partials/conditioning/boogu-image.yaml+5-5
core/pipelines/workflow_recipes/_partials/conditioning/qwen-image-2.1.yaml+5-4
mcp_tools/common.py+1-7
ui/events/chain_handlers.py+1-67
ui/events/change_handlers.py+2-6
ui/events/main.py+3-15
ui/events/run_handlers.py+1-5
ui/imagegen_ui.py+1-3
ui/shared/ui_components.py+3-61
yaml/chain_features.yaml+2-30
yaml/model_architecture_features.yaml+2-2
yaml/task_features.yaml-10