Add MCP tool examples
Browse filesFiles changed (16)
- core/pipelines/sd_image_pipeline.py-7
- core/pipelines/workflow_recipes/_partials/conditioning/sd15.yaml+6-12
- mcp_tools/common.py+113-1
- mcp_tools/get_feature_list.py+85
- mcp_tools/get_model_features.py+22
- mcp_tools/mcp_gradio_integration.py+33-7
- mcp_tools/run.py+64-1
- ui/events/change_handlers.py+2-6
- ui/events/main.py+2-5
- ui/events/run_handlers.py-2
- ui/shared/hires_fix_ui.py-1
- ui/shared/img2img_ui.py-1
- ui/shared/inpaint_ui.py-1
- ui/shared/outpaint_ui.py-1
- ui/shared/ui_components.py-1
- yaml/chain_features.yaml+4-4
47 unmodified lines4849505152535413 unmodified lines686970717273747576777885 unmodified lines16416516616716816917047 unmodified linesparams_string = f"{ui_inputs['positive_prompt']}\nNegative prompt: {ui_inputs['negative_prompt']}\n"params_string += f"Steps: {ui_inputs['num_inference_steps']}, Sampler: {ui_inputs['sampler']}, Scheduler: {ui_inputs['scheduler']}, CFG scale: {ui_inputs['guidance_scale']}, Seed: {current_seed}, Size: {width_for_meta}x{height_for_meta}, Base Model: {model_display_name}"if ui_inputs['task_type'] != 'txt2img': params_string += f", Denoise: {ui_inputs['denoise']}"if ui_inputs.get('clip_skip') and ui_inputs['clip_skip'] != 1: params_string += f", Clip skip: {abs(ui_inputs['clip_skip'])}"if loras_string: params_string += f", {loras_string}"pil_image.info = {'parameters': params_string.strip()}13 unmodified linesui_inputs['positive_prompt'] = sanitize_prompt(ui_inputs.get('positive_prompt', ''))ui_inputs['negative_prompt'] = sanitize_prompt(ui_inputs.get('negative_prompt', ''))if 'clip_skip' in ui_inputs and ui_inputs['clip_skip'] is not None:ui_inputs['clip_skip'] = -int(ui_inputs['clip_skip'])else:ui_inputs['clip_skip'] = -1required_models = self.get_required_models(model_display_name=model_display_name)85 unmodified lines"seed": ui_inputs['seed'], "steps": ui_inputs['num_inference_steps'], "cfg": ui_inputs['guidance_scale'],"sampler_name": ui_inputs['sampler'], "scheduler": ui_inputs['scheduler'],"batch_size": ui_inputs['batch_size'],"clip_skip": ui_inputs['clip_skip'],"denoise": ui_inputs['denoise'],"vae_name": ui_inputs.get('vae_name'),"guidance": ui_inputs.get('guidance', 3.5),47 unmodified lines48495051525313 unmodified lines67686970717285 unmodified lines15815916016116216347 unmodified linesparams_string = f"{ui_inputs['positive_prompt']}\nNegative prompt: {ui_inputs['negative_prompt']}\n"params_string += f"Steps: {ui_inputs['num_inference_steps']}, Sampler: {ui_inputs['sampler']}, Scheduler: {ui_inputs['scheduler']}, CFG scale: {ui_inputs['guidance_scale']}, Seed: {current_seed}, Size: {width_for_meta}x{height_for_meta}, Base Model: {model_display_name}"if ui_inputs['task_type'] != 'txt2img': params_string += f", Denoise: {ui_inputs['denoise']}"if loras_string: params_string += f", {loras_string}"pil_image.info = {'parameters': params_string.strip()}13 unmodified linesui_inputs['positive_prompt'] = sanitize_prompt(ui_inputs.get('positive_prompt', ''))ui_inputs['negative_prompt'] = sanitize_prompt(ui_inputs.get('negative_prompt', ''))required_models = self.get_required_models(model_display_name=model_display_name)85 unmodified lines"seed": ui_inputs['seed'], "steps": ui_inputs['num_inference_steps'], "cfg": ui_inputs['guidance_scale'],"sampler_name": ui_inputs['sampler'], "scheduler": ui_inputs['scheduler'],"batch_size": ui_inputs['batch_size'],"denoise": ui_inputs['denoise'],"vae_name": ui_inputs.get('vae_name'),"guidance": ui_inputs.get('guidance', 3.5),
7 unmodified lines891011121314151617181920212223242513 unmodified lines3940414243444546474819 unmodified lines686970717273747576777 unmodified linesckpt_loader:class_type: CheckpointLoaderSimpletitle: "Load Checkpoint"clip_set_last_layer:class_type: CLIPSetLastLayertitle: "CLIP Set Last Layer"connections:- from: "ckpt_loader:0"to: "ksampler:model"- from: "ckpt_loader:1"to: "clip_set_last_layer:clip"- from: "clip_set_last_layer:0"to: "pos_prompt:clip"- from: "clip_set_last_layer:0"to: "neg_prompt:clip"- from: "pos_prompt:0"to: "ksampler:positive"13 unmodified linesdynamic_lora_chains:lora_chain:template: "LoraLoader"start: "clip_set_last_layer"output_map:"ckpt_loader:0": "model""0": "clip"input_map:"model": "model""clip": "clip"19 unmodified linesdynamic_conditioning_chains:conditioning_chain:ksampler_node: "ksampler"clip_source: "clip_set_last_layer:0"ui_map:positive_prompt: "pos_prompt:text"negative_prompt: "neg_prompt:text"model_name: "ckpt_loader:ckpt_name"clip_skip: "clip_set_last_layer:stop_at_clip_layer"7 unmodified lines89101112131415161718192013 unmodified lines3435363738394041424319 unmodified lines6364656667686970717 unmodified linesckpt_loader:class_type: CheckpointLoaderSimpletitle: "Load Checkpoint"connections:- from: "ckpt_loader:0"to: "ksampler:model"- from: "ckpt_loader:1"to: "pos_prompt:clip"- from: "ckpt_loader:1"to: "neg_prompt:clip"- from: "pos_prompt:0"to: "ksampler:positive"13 unmodified linesdynamic_lora_chains:lora_chain:template: "LoraLoader"start: "ckpt_loader"output_map:"0": "model""1": "clip"input_map:"model": "model""clip": "clip"19 unmodified linesdynamic_conditioning_chains:conditioning_chain:ksampler_node: "ksampler"clip_source: "ckpt_loader:1"ui_map:positive_prompt: "pos_prompt:text"negative_prompt: "neg_prompt:text"model_name: "ckpt_loader:ckpt_name"
144 unmodified lines1451461471481491501511521531 unmodified line1551561571581591601 unmodified line1621631641651661671 unmodified line1691701711721731741 unmodified line1761771781791801811 unmodified line183184185186187188144 unmodified lines_COMMON_OPTIONAL_INPUTS = ["steps", "cfg", "sampler", "scheduler", "seed","negative_prompt", "batch_size", "chain", "async_execution",]_TASK_DEFINITIONS = [{"task_type": "txt2img",1 unmodified line"description": "Generate images from text prompts. Canvas width and height must be specified.","required_inputs": ["prompt", "width", "height"],"optional_inputs": _COMMON_OPTIONAL_INPUTS,},{"task_type": "img2img",1 unmodified line"description": "Perform global repaint and style transfer based on a source image. Denoise strength must be specified.","required_inputs": ["prompt", "image", "denoise"],"optional_inputs": _COMMON_OPTIONAL_INPUTS,},{"task_type": "inpaint",1 unmodified line"description": "Repaint specified masked regions of the input image (with alpha mask/channel).","required_inputs": ["prompt", "image"],"optional_inputs": ["denoise"] + _COMMON_OPTIONAL_INPUTS,},{"task_type": "outpaint",1 unmodified line"description": "Extend the canvas outward from the source image. Padding pixel values for top, bottom, left, and right must be specified.","required_inputs": ["prompt", "image", "pad_left", "pad_right", "pad_top", "pad_bottom"],"optional_inputs": _COMMON_OPTIONAL_INPUTS,},{"task_type": "hires_fix",1 unmodified line"description": "Enhance details and upscale an existing low-resolution image.","required_inputs": ["prompt", "image", "upscale_by"],"optional_inputs": ["upscaler", "denoise"] + _COMMON_OPTIONAL_INPUTS,},]144 unmodified lines1451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042051 unmodified line2072082092102112122132142152162172182192202212222232242252262272282292302312322332342351 unmodified line2372382392402412422432442452462472482492501 unmodified line2522532542552562572582592602612622632642651 unmodified line2672682692702712722732742752762772782792802812822831 unmodified line285286287288289290291292293294295296297298299300144 unmodified lines_COMMON_OPTIONAL_INPUTS = ["steps", "cfg", "sampler", "scheduler", "seed","negative_prompt", "batch_size", "zero_gpu_duration", "chain", "async_execution",]_COMMON_OPTIONAL_INPUTS_SCHEMA = {"seed": {"type": "integer","default": -1,"description": "Random seed for image generation. Default: -1 (random seed). Specify a non-negative integer for deterministic reproducible generation."},"batch_size": {"type": "integer","default": 1,"minimum": 1,"maximum": 16,"description": "Number of images generated in a single inference batch (1 to 16, default: 1)."},"zero_gpu_duration": {"type": "integer","default": 60,"minimum": 1,"maximum": 120,"description": "GPU execution time quota allocation in seconds on HuggingFace ZeroGPU spaces (default: 60, maximum: 120)."},"steps": {"type": "integer","description": "Number of inference steps. If omitted, model optimal default is automatically applied."},"cfg": {"type": "number","description": "Classifier-Free Guidance scale. If omitted, model optimal default is automatically applied."},"sampler": {"type": "string","description": "Sampling algorithm (e.g., 'euler', 'dpmpp_2m'). If omitted, model optimal default is applied."},"scheduler": {"type": "string","description": "Noise scheduler type (e.g., 'simple', 'karras'). If omitted, model optimal default is applied."},"negative_prompt": {"type": "string","default": "","description": "Negative prompt specifying undesired attributes or quality flaws to avoid."},"async_execution": {"type": "boolean","default": False,"description": "If true, submits task asynchronously and returns task_id immediately for polling via get_task_status."},"chain": {"type": "array","description": "List of injector objects for extended features (LoRA, ControlNet, IPAdapter, etc.). Must be a JSON array of dicts with 'injector_type'."}}_TASK_DEFINITIONS = [{"task_type": "txt2img",1 unmodified line"description": "Generate images from text prompts. Canvas width and height must be specified.","required_inputs": ["prompt", "width", "height"],"optional_inputs": _COMMON_OPTIONAL_INPUTS,"optional_inputs_schema": _COMMON_OPTIONAL_INPUTS_SCHEMA,"example_json_params": {"task_type": "txt2img","model": "stabilityai/SDXL-Base-1.0","prompt": "A majestic lion jumping from a big stone at night","width": 1024,"height": 1024},"example_json_params_with_chain": {"task_type": "txt2img","model": "stabilityai/SDXL-Base-1.0","prompt": "A majestic lion jumping from a big stone at night","width": 1024,"height": 1024,"chain": [{"injector_type": "lora","source": "Civitai","lora_value": "12345","scale": 0.8}]}},{"task_type": "img2img",1 unmodified line"description": "Perform global repaint and style transfer based on a source image. Denoise strength must be specified.","required_inputs": ["prompt", "image", "denoise"],"optional_inputs": _COMMON_OPTIONAL_INPUTS,"optional_inputs_schema": _COMMON_OPTIONAL_INPUTS_SCHEMA,"example_json_params": {"task_type": "img2img","model": "stabilityai/SDXL-Base-1.0","prompt": "A majestic lion jumping from a big stone at night","image": "https://example.com/source_image.png","denoise": 0.7}},{"task_type": "inpaint",1 unmodified line"description": "Repaint specified masked regions of the input image (with alpha mask/channel).","required_inputs": ["prompt", "image"],"optional_inputs": ["denoise"] + _COMMON_OPTIONAL_INPUTS,"optional_inputs_schema": _COMMON_OPTIONAL_INPUTS_SCHEMA,"example_json_params": {"task_type": "inpaint","model": "stabilityai/SDXL-Base-1.0","prompt": "red floral dress, detailed lace","image": "https://example.com/image_with_alpha_mask.png","denoise": 0.95}},{"task_type": "outpaint",1 unmodified line"description": "Extend the canvas outward from the source image. Padding pixel values for top, bottom, left, and right must be specified.","required_inputs": ["prompt", "image", "pad_left", "pad_right", "pad_top", "pad_bottom"],"optional_inputs": _COMMON_OPTIONAL_INPUTS,"optional_inputs_schema": _COMMON_OPTIONAL_INPUTS_SCHEMA,"example_json_params": {"task_type": "outpaint","model": "stabilityai/SDXL-Base-1.0","prompt": "beautiful scenery background, high quality","image": "https://example.com/source_image.png","pad_left": 128,"pad_right": 128,"pad_top": 0,"pad_bottom": 0}},{"task_type": "hires_fix",1 unmodified line"description": "Enhance details and upscale an existing low-resolution image.","required_inputs": ["prompt", "image", "upscale_by"],"optional_inputs": ["upscaler", "denoise"] + _COMMON_OPTIONAL_INPUTS,"optional_inputs_schema": _COMMON_OPTIONAL_INPUTS_SCHEMA,"example_json_params": {"task_type": "hires_fix","model": "stabilityai/SDXL-Base-1.0","prompt": "masterpiece, best quality, sharp focus","image": "https://example.com/low_res_image.png","upscale_by": 2.0,"upscaler": "nearest-exact","denoise": 0.55}},]
3 unmodified lines456789102 unmodified lines1314151617183 unmodified linesfrom .error_schema import make_not_found_errordef _build_feature_entry(chain_name: str, chain_data: dict, include_schema: bool = False) -> dict:entry = {"feature_name": chain_name,"chains": chain_data.get("chains", chain_name),2 unmodified lines"supported_tasks": chain_data.get("supported_tasks", []),"max_count": chain_data.get("max_count", 1),"usage_guideline": chain_data.get("usage_guideline", ""),}if include_schema:schema = deepcopy(chain_data.get("parameters_schema", {}))3 unmodified lines45678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485862 unmodified lines89909192939495969798991001011021033 unmodified linesfrom .error_schema import make_not_found_errordef _get_default_example_chain_item(chain_name: str, chain_data: dict) -> dict:if "example_chain_item" in chain_data and isinstance(chain_data["example_chain_item"], dict):return deepcopy(chain_data["example_chain_item"])if chain_name == "lora":return {"injector_type": "lora","source": "Civitai","lora_value": "12345","scale": 1.0,}elif chain_name == "ipadapter":return {"injector_type": "ipadapter","image": "https://example.com/reference_image.png","weight": 1.0,"preset": "STANDARD (medium strength)",}elif chain_name in ("controlnet", "diffsynth_controlnet", "krea2_controlnet", "anima_controlnet_lllite"):return {"injector_type": chain_name,"type": "Depth","series": "SDXL" if chain_name == "controlnet" else "Patil","image": "https://example.com/control_depth_map.png","strength": 1.0,}elif chain_name == "conditioning":return {"injector_type": "conditioning","prompt": "blue sky with soft clouds","x": 0,"y": 0,"width": 1024,"height": 512,"strength": 1.0,}elif chain_name == "vae":return {"injector_type": "vae","source": "Civitai","vae_value": "12345",}elif chain_name == "embedding":return {"injector_type": "embedding","source": "Civitai","embedding_value": "12345",}elif chain_name == "pid":return {"injector_type": "pid","enabled": True,}injector_type = chain_data.get("chains")if isinstance(injector_type, list):injector_type = injector_type[0]elif not isinstance(injector_type, str):injector_type = chain_nameitem = {"injector_type": injector_type}schema = chain_data.get("parameters_schema", {})props = schema.get("properties", {})for p_name, p_info in props.items():if p_name == "image":item["image"] = "https://example.com/reference.png"elif p_name == "source":item["source"] = "Civitai"elif p_name in ("weight", "strength", "scale", "factor"):item[p_name] = p_info.get("default", 1.0)elif p_name == "enabled":item["enabled"] = Truereturn itemdef _build_feature_entry(chain_name: str, chain_data: dict, include_schema: bool = False) -> dict:example_item = _get_default_example_chain_item(chain_name, chain_data)entry = {"feature_name": chain_name,"chains": chain_data.get("chains", chain_name),2 unmodified lines"supported_tasks": chain_data.get("supported_tasks", []),"max_count": chain_data.get("max_count", 1),"usage_guideline": chain_data.get("usage_guideline", ""),"example_chain_item": example_item,"example_json_params": {"task_type": "txt2img","model": "stabilityai/SDXL-Base-1.0","prompt": "A majestic lion jumping from a big stone at night","width": 1024,"height": 1024,"chain": [example_item],},}if include_schema:schema = deepcopy(chain_data.get("parameters_schema", {}))
83 unmodified lines84858687888983 unmodified lines"supported_tasks": supported_tasks,"supported_features": supported_features,"default_parameter": default_parameter,}default_pos = model_specific_defaults.get(83 unmodified lines8485868788899091929394959697989910010110210310410510610710810911011183 unmodified lines"supported_tasks": supported_tasks,"supported_features": supported_features,"default_parameter": default_parameter,"example_json_params": {"task_type": "txt2img","model": model,"prompt": "A majestic lion jumping from a big stone at night","width": 1024,"height": 1024},"example_json_params_with_chain": {"task_type": "txt2img","model": model,"prompt": "A majestic lion jumping from a big stone at night","width": 1024,"height": 1024,"chain": [{"injector_type": "lora","source": "Civitai","lora_value": "12345","scale": 1.0}]}}default_pos = model_specific_defaults.get(
74 unmodified lines757677787980812 unmodified lines848586878889909192939495969798991001011025 unmodified lines10810911011111211311474 unmodified linesUsing gr.api() never adds any visual UI components (such as Row, Textbox, Button, etc.), avoiding duplicate interface rendering."""def get_task_list() -> list:"""[Recommended Discovery Flow Step 1] Get a list of all supported image generation task types (txt2img, img2img, inpaint, outpaint, hires_fix) along with their required and optional parameter lists. Recommended flow: get_task_list -> get_model_architecture_list -> get_model_list -> [Path 1: Call run directly (pass only required params) | Path 2: Call get_model_features to get official default hyperparams -> run]."""return sanitize_keys(handle_get_task_list())def get_model_architecture_list() -> list:2 unmodified linesdef get_model_list(model_architecture: str = "") -> list | dict:"""[Recommended Discovery Flow Step 3] Query the list of available image generation models. After obtaining models, choose one of two paths: 1. [Path 1 (Recommended - Minimal Mode)] Call run directly with only required parameters. Do NOT guess steps/cfg/sampler/scheduler from experience; the server will automatically apply the model's optimal default hyperparameters. 2. [Path 2 (Explicit Alignment Mode)] First call get_model_features to query the model's officially recommended hyperparameters, then pass them to run."""arch = model_architecture.strip() if model_architecture else Nonereturn sanitize_keys(handle_get_model_list(arch))def get_feature_list(feature_name: str = "") -> list | dict:"""Get supported advanced features. If feature_name is empty, returns a summary list of ALL features (excluding parameters_schema to save tokens). Pass a specific feature_name (single name like 'lora', or comma-separated like 'lora, ipadapter') to retrieve complete details INCLUDING parameters_schema for requested feature(s)."""return sanitize_keys(handle_get_feature_list(feature_name.strip() if isinstance(feature_name, str) else feature_name))def get_model_features(model: str = "") -> dict:"""Query metadata for the specified model, including supported task types, extended features, and official default inference parameters (steps, cfg, sampler, scheduler). This tool MUST be called when explicitly obtaining a model's optimal default hyperparameters (Path 2). Guessing or fabricating hyperparameters without querying is strictly prohibited."""return sanitize_keys(handle_get_model_features(model.strip()))def run(json_params: str = "{}") -> dict:"""[Recommended Discovery Flow Step 4] Unified image generation task execution interface. Supports txt2img, img2img, and other tasks with chainable extended features. [IMPORTANT PARAMETER RULES] Do NOT guess or fabricate inference hyperparameters such as steps, cfg, sampler, scheduler! Path 1 (Recommended): Pass only required parameters (task_type, model, prompt, width, height), leave optional hyperparams empty (server uses optimal defaults). Path 2: If explicit hyperparams are needed, you MUST first call get_model_features to obtain official defaults before passing them."""try:if isinstance(json_params, dict):params = json_params5 unmodified linesdef get_task_status(task_id: str = "") -> dict:"""Query the progress, status, and final generated results of an async image generation task."""return sanitize_keys(handle_get_task_status(task_id.strip()))funcs = [get_task_list,74 unmodified lines757677787980812 unmodified lines848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241255 unmodified lines13113213313413513613713813914074 unmodified linesUsing gr.api() never adds any visual UI components (such as Row, Textbox, Button, etc.), avoiding duplicate interface rendering."""def get_task_list() -> list:"""[Recommended Discovery Flow Step 1] Get a list of all supported image generation task types (txt2img, img2img, inpaint, outpaint, hires_fix) along with their required/optional parameters and paste-and-run example_json_params. Recommended flow: get_task_list -> get_model_architecture_list -> get_model_list -> run."""return sanitize_keys(handle_get_task_list())def get_model_architecture_list() -> list:2 unmodified linesdef get_model_list(model_architecture: str = "") -> list | dict:"""[Recommended Discovery Flow Step 3] Query the list of available image generation models. After obtaining models, choose one of two paths: 1. [Path 1 (Recommended - Minimal Mode)] Call run directly with only required parameters. Do NOT guess steps/cfg/sampler/scheduler from experience; the server will automatically apply the model's optimal default hyperparameters. 2. [Path 2 (Explicit Alignment Mode)] First call get_model_features to query the model's officially recommended hyperparameters, then pass them to run."""if isinstance(model_architecture, dict):model_architecture = model_architecture.get("model_architecture") or model_architecture.get("arch") or ""arch = model_architecture.strip() if isinstance(model_architecture, str) and model_architecture.strip() else Nonereturn sanitize_keys(handle_get_model_list(arch))def get_feature_list(feature_name: str = "") -> list | dict:"""Get supported advanced features (LoRA, ControlNet, IPAdapter, etc.). Each feature includes ready-to-run example_chain_item and example_json_params. If feature_name is empty, returns summary of ALL features. Pass specific feature_name to retrieve complete parameters_schema."""if isinstance(feature_name, dict):feature_name = feature_name.get("feature_name") or feature_name.get("name") or ""return sanitize_keys(handle_get_feature_list(feature_name.strip() if isinstance(feature_name, str) else feature_name))def get_model_features(model: str = "") -> dict:"""Query metadata for the specified model, including supported task types, extended features, default parameters, and paste-and-run example_json_params."""if isinstance(model, dict):model = model.get("model") or model.get("name") or ""model_str = model.strip() if isinstance(model, str) else ""return sanitize_keys(handle_get_model_features(model_str))def run(json_params: str = "{}") -> dict:"""[Recommended Discovery Flow Step 4] Unified image generation task execution interface. Accepts a JSON string or dict of parameters.OPTIONAL CONTROL PARAMETERS:- seed (int): Random seed (-1 for random, >=0 for deterministic reproducibility). Default: -1.- batch_size (int): Number of images generated per batch (1 to 16). Default: 1.- zero_gpu_duration (int): GPU quota allocation in seconds on HuggingFace ZeroGPU spaces (default: 60, max: 120).- negative_prompt (str): Text prompt specifying elements to avoid.IMPORTANT FORMAT RULES FOR 'chain':- For LoRA/Civitai: 'lora_value' refers to the Civitai Version ID (modelVersionId), not the main Model ID.Paste-and-Run Example (Basic):{"task_type": "txt2img", "model": "stabilityai/SDXL-Base-1.0", "prompt": "A majestic lion jumping from a big stone at night", "width": 1024, "height": 1024}Paste-and-Run Example (With chain):{"task_type": "txt2img", "model": "stabilityai/SDXL-Base-1.0", "prompt": "A majestic lion jumping from a big stone at night", "width": 1024, "height": 1024, "chain": [{"injector_type": "lora", "source": "Civitai", "lora_value": "12345", "scale": 1.0}]}"""try:if isinstance(json_params, dict):params = json_params5 unmodified linesdef get_task_status(task_id: str = "") -> dict:"""Query the progress, status, and final generated results of an async image generation task."""if isinstance(task_id, dict):task_id = task_id.get("task_id") or task_id.get("id") or ""task_id_str = task_id.strip() if isinstance(task_id, str) else ""return sanitize_keys(handle_get_task_status(task_id_str))funcs = [get_task_list,
16 unmodified lines1718192021222315 unmodified lines39404142434416 unmodified linesdef handle_run(params: dict) -> dict:"""Unified image generation task execution interface."""if not isinstance(params, dict):return make_validation_error("Request params must be an object.")15 unmodified linesinvalid_fields={"task_type": f"Must be in {valid_tasks}"},)model_list = _load_yaml(_MODEL_LIST_PATH)checkpoints = model_list.get("Checkpoint", {})all_models = set()16 unmodified lines17181920212223242526272829303132333435363738394041424344454647484950515253545556575815 unmodified lines747576777879808182838485868788899091929394959697989910010110210310410510610716 unmodified linesdef handle_run(params: dict) -> dict:"""Unified image generation task execution interface.[OPTIONAL CONTROL PARAMETERS]- seed (int): Random seed for generation. Default: -1 (random seed). Specify >=0 for deterministic reproducibility.- batch_size (int): Number of images generated in a single batch (1 to 16, default: 1).- zero_gpu_duration (int): GPU quota allocation in seconds on HuggingFace ZeroGPU spaces (default: 60, max: 120).- negative_prompt (str): Text prompt specifying undesirable elements to avoid.- steps (int), cfg (float), sampler (str), scheduler (str): Inference hyperparams (auto-applied from model defaults if omitted).[Paste-and-Run json_params Example (Basic)]{"task_type": "txt2img","model": "stabilityai/SDXL-Base-1.0","prompt": "A majestic lion jumping from a big stone at night","width": 1024,"height": 1024}[Paste-and-Run json_params Example (With chain)]{"task_type": "txt2img","model": "stabilityai/SDXL-Base-1.0","prompt": "A majestic lion jumping from a big stone at night","width": 1024,"height": 1024,"chain": [{"injector_type": "lora","source": "Civitai","lora_value": "12345","scale": 1.0}]}"""if not isinstance(params, dict):return make_validation_error("Request params must be an object.")15 unmodified linesinvalid_fields={"task_type": f"Must be in {valid_tasks}"},)if "chain" in params and params["chain"] is not None:chain_val = params["chain"]if isinstance(chain_val, dict):return make_validation_error("Parameter 'chain' must be a JSON array (list) of injector objects [{'injector_type': 'lora', ...}], but received a dictionary. ""Do NOT structure chain as a dict like {'lora': [...]}. ""Example correct format: [{'injector_type': 'lora', 'source': 'Civitai', 'lora_value': '12345', 'scale': 1.0}]",invalid_fields={"chain": "Expected list of objects, received dict"},)if not isinstance(chain_val, list):return make_validation_error("Parameter 'chain' must be a JSON array (list) of injector objects.",invalid_fields={"chain": f"Expected list, received {type(chain_val).__name__}"},)for idx, item in enumerate(chain_val):if not isinstance(item, dict):return make_validation_error(f"Item at chain[{idx}] must be an object (dict) containing 'injector_type'. "f"Example: {{'injector_type': 'lora', 'source': 'Civitai', 'lora_value': '12345', 'scale': 1.0}}",invalid_fields={f"chain[{idx}]": f"Expected dict, received {type(item).__name__}"},)if "injector_type" not in item or not item["injector_type"]:return make_validation_error(f"Item at chain[{idx}] is missing required string field 'injector_type'. "f"Example: {{'injector_type': 'lora', 'source': 'Civitai', 'lora_value': '12345', 'scale': 1.0}}",missing_fields=[f"chain[{idx}].injector_type"],)model_list = _load_yaml(_MODEL_LIST_PATH)checkpoints = model_list.get("Checkpoint", {})all_models = set()
16 unmodified lines1718192021222353 unmodified lines777879808182838463 unmodified lines14814915015115215315458 unmodified lines21321421521621721821922016 unmodified linesload_ipadapter_config)def make_update_fn(m_comp, cat_comp, cs_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, guidance_comp, 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, boogu_edit_acc=None, ref_img_acc=None):def update_fn(*args):arch = args[0]category = args[1]53 unmodified linesif 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))if cs_comp:updates[cs_comp] = gr.update(visible=(arch_model_type == "sd15"))if guidance_comp:updates[guidance_comp] = gr.update(visible=(arch_model_type == "flux1"))63 unmodified linesreturn update_fndef make_model_change_fn(cat_comp_ref, cs_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, 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, guidance_comp, 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, boogu_edit_acc=None, ref_img_acc=None):def change_fn(*args):model_name = args[0]idx = 158 unmodified linesif 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))if cs_comp:updates[cs_comp] = gr.update(visible=(arch_model_type == "sd15"))if guidance_comp:updates[guidance_comp] = gr.update(visible=(arch_model_type == "flux1"))16 unmodified lines1718192021222353 unmodified lines77787980818263 unmodified lines14614714814915015115258 unmodified lines21121221321421521616 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, guidance_comp, 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, boogu_edit_acc=None, ref_img_acc=None):def update_fn(*args):arch = args[0]category = args[1]53 unmodified linesif 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))if guidance_comp:updates[guidance_comp] = gr.update(visible=(arch_model_type == "flux1"))63 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, guidance_comp, 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, boogu_edit_acc=None, ref_img_acc=None):def change_fn(*args):model_name = args[0]idx = 158 unmodified linesif 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))if guidance_comp:updates[guidance_comp] = gr.update(visible=(arch_model_type == "flux1"))
36 unmodified lines3738394041424351 unmodified lines959697989910010126 unmodified lines12812913013113213313412 unmodified lines14714814915015115215331 unmodified lines18518618718818919019136 unmodified linesarch_comp = ui_components.get(f'model_arch_{prefix}')cat_comp = ui_components.get(f'model_cat_{prefix}')model_comp = ui_components.get(f'base_model_{prefix}')clip_skip_comp = ui_components.get(f'clip_skip_{prefix}') or ui_components.get(f'{prefix}_clip_skip')guidance_comp = ui_components.get(f'guidance_{prefix}') or ui_components.get(f'{prefix}_guidance')aspect_ratio_comp = ui_components.get(f'aspect_ratio_{prefix}') or ui_components.get(f'{prefix}_aspect_ratio_dropdown')width_comp = ui_components.get(f'width_{prefix}') or ui_components.get(f'{prefix}_width')51 unmodified linesif arch_comp and cat_comp and model_comp:outputs = [model_comp, cat_comp]if clip_skip_comp: outputs.append(clip_skip_comp)if guidance_comp: outputs.append(guidance_comp)if aspect_ratio_comp: outputs.append(aspect_ratio_comp)outputs.extend(cn_types_list + cn_series_list + cn_filepaths_list)26 unmodified linesoutputs.extend(valid_extra_comps)update_fn = make_update_fn(model_comp, cat_comp, clip_skip_comp, aspect_ratio_comp, width_comp, height_comp,cn_types_list, cn_series_list, cn_filepaths_list,anima_cn_types_list, anima_cn_series_list, anima_cn_filepaths_list,diffsynth_cn_types_list, diffsynth_cn_series_list, diffsynth_cn_filepaths_list,12 unmodified linesoutputs2 = []if arch_comp: outputs2.append(arch_comp)if cat_comp: outputs2.append(cat_comp)if clip_skip_comp: outputs2.append(clip_skip_comp)if guidance_comp: outputs2.append(guidance_comp)if aspect_ratio_comp: outputs2.append(aspect_ratio_comp)outputs2.extend(cn_types_list + cn_series_list + cn_filepaths_list)31 unmodified linesif cat_comp: inputs2.append(cat_comp)if aspect_ratio_comp: inputs2.append(aspect_ratio_comp)change_fn = make_model_change_fn(cat_comp, clip_skip_comp, aspect_ratio_comp, width_comp, height_comp,cn_types_list, cn_series_list, cn_filepaths_list,anima_cn_types_list, anima_cn_series_list, anima_cn_filepaths_list,diffsynth_cn_types_list, diffsynth_cn_series_list, diffsynth_cn_filepaths_list,36 unmodified lines37383940414251 unmodified lines94959697989926 unmodified lines12612712812913013113212 unmodified lines14514614714814915031 unmodified lines18218318418518618718836 unmodified linesarch_comp = ui_components.get(f'model_arch_{prefix}')cat_comp = ui_components.get(f'model_cat_{prefix}')model_comp = ui_components.get(f'base_model_{prefix}')guidance_comp = ui_components.get(f'guidance_{prefix}') or ui_components.get(f'{prefix}_guidance')aspect_ratio_comp = ui_components.get(f'aspect_ratio_{prefix}') or ui_components.get(f'{prefix}_aspect_ratio_dropdown')width_comp = ui_components.get(f'width_{prefix}') or ui_components.get(f'{prefix}_width')51 unmodified linesif arch_comp and cat_comp and model_comp:outputs = [model_comp, cat_comp]if guidance_comp: outputs.append(guidance_comp)if aspect_ratio_comp: outputs.append(aspect_ratio_comp)outputs.extend(cn_types_list + cn_series_list + cn_filepaths_list)26 unmodified linesoutputs.extend(valid_extra_comps)update_fn = make_update_fn(model_comp, cat_comp, aspect_ratio_comp, width_comp, height_comp,cn_types_list, cn_series_list, cn_filepaths_list,anima_cn_types_list, anima_cn_series_list, anima_cn_filepaths_list,diffsynth_cn_types_list, diffsynth_cn_series_list, diffsynth_cn_filepaths_list,12 unmodified linesoutputs2 = []if arch_comp: outputs2.append(arch_comp)if cat_comp: outputs2.append(cat_comp)if guidance_comp: outputs2.append(guidance_comp)if aspect_ratio_comp: outputs2.append(aspect_ratio_comp)outputs2.extend(cn_types_list + cn_series_list + cn_filepaths_list)31 unmodified linesif cat_comp: inputs2.append(cat_comp)if aspect_ratio_comp: inputs2.append(aspect_ratio_comp)change_fn = make_model_change_fn(cat_comp, aspect_ratio_comp, width_comp, height_comp,cn_types_list, cn_series_list, cn_filepaths_list,anima_cn_types_list, anima_cn_series_list, anima_cn_filepaths_list,diffsynth_cn_types_list, diffsynth_cn_series_list, diffsynth_cn_filepaths_list,
12 unmodified lines131415161718192012 unmodified lines'sampler': ui_components.get(f'sampler_{prefix}') or ui_components.get(f'{prefix}_sampler_name'),'scheduler': ui_components.get(f'scheduler_{prefix}') or ui_components.get(f'{prefix}_scheduler'),'zero_gpu_duration': ui_components.get(f'zero_gpu_{prefix}'),'clip_skip': ui_components.get(f'clip_skip_{prefix}'),'guidance': ui_components.get(f'guidance_{prefix}'),'task_type': gr.State(task_type)}12 unmodified lines13141516171812 unmodified lines'sampler': ui_components.get(f'sampler_{prefix}') or ui_components.get(f'{prefix}_sampler_name'),'scheduler': ui_components.get(f'scheduler_{prefix}') or ui_components.get(f'{prefix}_scheduler'),'zero_gpu_duration': ui_components.get(f'zero_gpu_{prefix}'),'guidance': ui_components.get(f'guidance_{prefix}'),'task_type': gr.State(task_type)}
76 unmodified lines7778798081828376 unmodified linescomponents[f'seed_{prefix}'] = gr.Number(label="Seed (-1 for random)", value=-1, precision=0)components[f'batch_size_{prefix}'] = gr.Slider(label="Batch Size", minimum=1, maximum=16, step=1, value=1)with gr.Row():components[f'clip_skip_{prefix}'] = gr.Slider(label="Clip Skip", minimum=1, maximum=2, step=1, value=1, visible=False, interactive=True)components[f'guidance_{prefix}'] = gr.Slider(label="Guidance (FLUX)", minimum=1.0, maximum=10.0, step=0.1, value=3.5, visible=False, interactive=True)components[f'zero_gpu_{prefix}'] = gr.Number(label="ZeroGPU Duration (s)", value=None, placeholder="Default: 60s, Max: 120s", info="Optional: Set how long to reserve the GPU.")76 unmodified lines77787980818276 unmodified linescomponents[f'seed_{prefix}'] = gr.Number(label="Seed (-1 for random)", value=-1, precision=0)components[f'batch_size_{prefix}'] = gr.Slider(label="Batch Size", minimum=1, maximum=16, step=1, value=1)with gr.Row():components[f'guidance_{prefix}'] = gr.Slider(label="Guidance (FLUX)", minimum=1.0, maximum=10.0, step=0.1, value=3.5, visible=False, interactive=True)components[f'zero_gpu_{prefix}'] = gr.Number(label="ZeroGPU Duration (s)", value=None, placeholder="Default: 60s, Max: 120s", info="Optional: Set how long to reserve the GPU.")
60 unmodified lines6162636465666760 unmodified linescomponents[f'seed_{prefix}'] = gr.Number(label="Seed (-1 for random)", value=-1, precision=0)components[f'batch_size_{prefix}'] = gr.Slider(label="Batch Size", minimum=1, maximum=16, step=1, value=1)with gr.Row():components[f'clip_skip_{prefix}'] = gr.Slider(label="Clip Skip", minimum=1, maximum=2, step=1, value=1, visible=False, interactive=True)components[f'guidance_{prefix}'] = gr.Slider(label="Guidance (FLUX)", minimum=1.0, maximum=10.0, step=0.1, value=3.5, visible=False, interactive=True)components[f'zero_gpu_{prefix}'] = gr.Number(label="ZeroGPU Duration (s)", value=None, placeholder="Default: 60s, Max: 120s", info="Optional: Set how long to reserve the GPU. Longer jobs may need more time.")60 unmodified lines61626364656660 unmodified linescomponents[f'seed_{prefix}'] = gr.Number(label="Seed (-1 for random)", value=-1, precision=0)components[f'batch_size_{prefix}'] = gr.Slider(label="Batch Size", minimum=1, maximum=16, step=1, value=1)with gr.Row():components[f'guidance_{prefix}'] = gr.Slider(label="Guidance (FLUX)", minimum=1.0, maximum=10.0, step=0.1, value=3.5, visible=False, interactive=True)components[f'zero_gpu_{prefix}'] = gr.Number(label="ZeroGPU Duration (s)", value=None, placeholder="Default: 60s, Max: 120s", info="Optional: Set how long to reserve the GPU. Longer jobs may need more time.")
86 unmodified lines8788899091929386 unmodified linescomponents[f'seed_{prefix}'] = gr.Number(label="Seed (-1 for random)", value=-1, precision=0)components[f'batch_size_{prefix}'] = gr.Slider(label="Batch Size", minimum=1, maximum=16, step=1, value=1)with gr.Row():components[f'clip_skip_{prefix}'] = gr.Slider(label="Clip Skip", minimum=1, maximum=2, step=1, value=1, visible=False, interactive=True)components[f'guidance_{prefix}'] = gr.Slider(label="Guidance (FLUX)", minimum=1.0, maximum=10.0, step=0.1, value=3.5, visible=False, interactive=True)components[f'zero_gpu_{prefix}'] = gr.Number(label="ZeroGPU Duration (s)", value=None, placeholder="Default: 60s, Max: 120s", info="Optional: Set how long to reserve the GPU.")86 unmodified lines87888990919286 unmodified linescomponents[f'seed_{prefix}'] = gr.Number(label="Seed (-1 for random)", value=-1, precision=0)components[f'batch_size_{prefix}'] = gr.Slider(label="Batch Size", minimum=1, maximum=16, step=1, value=1)with gr.Row():components[f'guidance_{prefix}'] = gr.Slider(label="Guidance (FLUX)", minimum=1.0, maximum=10.0, step=0.1, value=3.5, visible=False, interactive=True)components[f'zero_gpu_{prefix}'] = gr.Number(label="ZeroGPU Duration (s)", value=None, placeholder="Default: 60s, Max: 120s", info="Optional: Set how long to reserve the GPU.")
72 unmodified lines7374757677787972 unmodified linescomponents[f'seed_{prefix}'] = gr.Number(label="Seed (-1 for random)", value=-1, precision=0)components[f'batch_size_{prefix}'] = gr.Slider(label="Batch Size", minimum=1, maximum=16, step=1, value=1)with gr.Row():components[f'clip_skip_{prefix}'] = gr.Slider(label="Clip Skip", minimum=1, maximum=2, step=1, value=1, visible=False, interactive=True)components[f'guidance_{prefix}'] = gr.Slider(label="Guidance (FLUX)", minimum=1.0, maximum=10.0, step=0.1, value=3.5, visible=False, interactive=True)components[f'zero_gpu_{prefix}'] = gr.Number(label="ZeroGPU Duration (s)", value=None, placeholder="Default: 60s, Max: 120s", info="Optional: Set how long to reserve the GPU.")72 unmodified lines73747576777872 unmodified linescomponents[f'seed_{prefix}'] = gr.Number(label="Seed (-1 for random)", value=-1, precision=0)components[f'batch_size_{prefix}'] = gr.Slider(label="Batch Size", minimum=1, maximum=16, step=1, value=1)with gr.Row():components[f'guidance_{prefix}'] = gr.Slider(label="Guidance (FLUX)", minimum=1.0, maximum=10.0, step=0.1, value=3.5, visible=False, interactive=True)components[f'zero_gpu_{prefix}'] = gr.Number(label="ZeroGPU Duration (s)", value=None, placeholder="Default: 60s, Max: 120s", info="Optional: Set how long to reserve the GPU.")
113 unmodified lines114115116117118119120113 unmodified linescomponents[f'seed_{prefix}'] = gr.Number(label="Seed (-1 for random)", value=-1, precision=0)components[f'batch_size_{prefix}'] = gr.Slider(label="Batch Size", minimum=1, maximum=16, step=1, value=1)with gr.Row():components[f'clip_skip_{prefix}'] = gr.Slider(label="Clip Skip", minimum=1, maximum=2, step=1, value=1, visible=False, interactive=True)components[f'guidance_{prefix}'] = gr.Slider(label="Guidance (FLUX)", minimum=1.0, maximum=10.0, step=0.1, value=3.5, visible=False, interactive=True)components[f'zero_gpu_{prefix}'] = gr.Number(label="ZeroGPU Duration (s)", value=None, placeholder="Default: 60s, Max: 120s", info="Optional: Set how long to reserve the GPU.")113 unmodified lines114115116117118119113 unmodified linescomponents[f'seed_{prefix}'] = gr.Number(label="Seed (-1 for random)", value=-1, precision=0)components[f'batch_size_{prefix}'] = gr.Slider(label="Batch Size", minimum=1, maximum=16, step=1, value=1)with gr.Row():components[f'guidance_{prefix}'] = gr.Slider(label="Guidance (FLUX)", minimum=1.0, maximum=10.0, step=0.1, value=3.5, visible=False, interactive=True)components[f'zero_gpu_{prefix}'] = gr.Number(label="ZeroGPU Duration (s)", value=None, placeholder="Default: 60s, Max: 120s", info="Optional: Set how long to reserve the GPU.")
3 unmodified lines456789101 unmodified line12131415161718192021222324252627283 unmodified lineslora:chains: loradisplay_name: "LoRA Fine-tuning Injector"description: "Injects LoRA weights into UNet/DiT model and CLIP text encoder for custom style, character, or domain adaptation."supported_tasks:- txt2img- img2img1 unmodified line- outpaint- hires_fixmax_count: 5usage_guideline: "Specify source ('Civitai' or 'Hugging Face'), then provide the lora_value (Civitai Version ID or HF repo path), and a single scale value (0.0~2.0) that controls both model and clip strength simultaneously."parameters_schema:type: objectproperties:source:type: stringenum: ["Civitai", "Hugging Face"]description: "Download source for the LoRA model. Use 'Civitai' to download by Version ID, or 'Hugging Face' to download by repo path."lora_value:type: stringdescription: "For Civitai: the Version ID (e.g., '456' from civitai.com/models/123?modelVersionId=456). For Hugging Face: repo_id/filename.extension or repo_id/folder_path/filename.extension (e.g., 'lightx2v/Qwen-Image-Lightning/Qwen-Image-Lightning-4steps-V2.0-bf16.safetensors')."scale:type: numberdefault: 1.03 unmodified lines456789101 unmodified line12131415161718192021222324252627283 unmodified lineslora:chains: loradisplay_name: "LoRA Fine-tuning Injector"description: "Injects LoRA weights into UNet/DiT model and CLIP text encoder for custom style, character, or domain adaptation. Note: For Civitai, specify the Version ID (modelVersionId) instead of the main Model ID."supported_tasks:- txt2img- img2img1 unmodified line- outpaint- hires_fixmax_count: 5usage_guideline: "Specify source ('Civitai' or 'Hugging Face'). For Civitai, provide lora_value as the Version ID (modelVersionId). For Hugging Face, provide HF repo file path. Scale (0.0~2.0) controls weight strength."parameters_schema:type: objectproperties:source:type: stringenum: ["Civitai", "Hugging Face"]description: "Download source for the LoRA model. Use 'Civitai' to download by Version ID (modelVersionId), or 'Hugging Face' to download by repo file path."lora_value:type: stringdescription: "For Civitai: the Version ID (modelVersionId). For Hugging Face: repo_id/filename.extension or repo_id/folder_path/filename.extension."scale:type: numberdefault: 1.0
core/pipelines/sd_image_pipeline.py-7
core/pipelines/workflow_recipes/_partials/conditioning/sd15.yaml+6-12
mcp_tools/common.py+113-1
mcp_tools/get_feature_list.py+85
mcp_tools/get_model_features.py+22
mcp_tools/mcp_gradio_integration.py+33-7
mcp_tools/run.py+64-1
ui/events/change_handlers.py+2-6
ui/events/main.py+2-5
ui/events/run_handlers.py-2
ui/shared/hires_fix_ui.py-1
ui/shared/img2img_ui.py-1
ui/shared/inpaint_ui.py-1
ui/shared/outpaint_ui.py-1
ui/shared/ui_components.py-1
yaml/chain_features.yaml+4-4