Files
Runware-ComfyUI-Runware/modules/safetyInputs.py
T
Sirshendu Ganguly 843422e01c Add provider settings support and new input nodes for upscale/background removal
- Add Ovi/Bria provider settings support for upscaler and background removal
- Add new Safety Inputs node (modules/safetyInputs.py) for content moderation settings
- Add new Video Advanced Feature Inputs node (modules/videoAdvancedFeatureInputs.py) for CFG scales, negative prompts, and SLG layer settings
- Fix advanced feature inputs to be properly nested under 'advancedFeatures' key (matching safety inputs pattern)
- Update bgremoval.py with provider settings support
- Update upscaler.py with provider settings support
- Update videoInference.py to handle safety and advanced feature inputs correctly
- Update acceleratorOptions.py with improved caching options
- Update briaImageProviderSettings.py with additional settings
- Update videoInferenceInputs.py with new input support
- Update videoModelSearch.py with model enhancements
- Update all workflow JSON files to use new nodes
- Add new Runware_Image_to_Video_Ovi.json workflow
- Update TypeScript types in clientlibs/types.js
- Register new nodes in __init__.py
2025-10-28 23:09:47 -04:00

74 lines
2.5 KiB
Python

from typing import Optional, Dict, Any
class safetyInputs:
"""Runware Safety Inputs Node"""
@classmethod
def INPUT_TYPES(cls):
return {
"required": {},
"optional": {
"mode": (["none", "fast", "full"], {
"tooltip": "Safety moderation mode: none (disable), fast (quick check), or full (comprehensive check).",
"default": "none",
}),
"tolerance": ("BOOLEAN", {
"tooltip": "Safety tolerance setting for content moderation.",
"default": None,
"label_on": "Enabled",
"label_off": "Disabled",
}),
"checkInputs": ("BOOLEAN", {
"tooltip": "Enable checking of input content for safety violations.",
"default": None,
"label_on": "Enabled",
"label_off": "Disabled",
}),
"checkContent": ("BOOLEAN", {
"tooltip": "Enable checking of generated content for safety violations.",
"default": None,
"label_on": "Enabled",
"label_off": "Disabled",
}),
}
}
RETURN_TYPES = ("RUNWARESAFETYINPUTS",)
RETURN_NAMES = ("Safety Inputs",)
FUNCTION = "create_safety_inputs"
CATEGORY = "Runware"
DESCRIPTION = "Configure safety and content moderation settings for Runware tasks."
def create_safety_inputs(self, **kwargs) -> tuple[Dict[str, Any]]:
"""Create safety inputs dictionary"""
# Get parameters
mode = kwargs.get("mode", None)
tolerance = kwargs.get("tolerance", None)
checkInputs = kwargs.get("checkInputs", None)
checkContent = kwargs.get("checkContent", None)
# Build safety inputs dictionary - only include non-None values
safety_inputs = {}
if mode is not None:
safety_inputs["mode"] = mode
if tolerance is not None:
safety_inputs["tolerance"] = tolerance
if checkInputs is not None:
safety_inputs["checkInputs"] = checkInputs
if checkContent is not None:
safety_inputs["checkContent"] = checkContent
return (safety_inputs,)
# Node class mappings
NODE_CLASS_MAPPINGS = {
"RunwareSafetyInputs": safetyInputs,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"RunwareSafetyInputs": "Runware Safety Inputs",
}