Add safety filter to Kontext.

This commit is contained in:
Robin Huang 2025-05-27 18:21:03 -07:00
parent 8983af3925
commit e14314f97f

View File

@ -329,6 +329,15 @@ class FluxKontextProImageNode(ComfyNodeABC):
"tooltip": "The random seed used for creating the noise.", "tooltip": "The random seed used for creating the noise.",
}, },
), ),
"safety_tolerance": (
IO.INT,
{
"default": 2,
"min": 0,
"max": 2,
"tooltip": "Safety tolerance for the image generation process",
},
),
"prompt_upsampling": ( "prompt_upsampling": (
IO.BOOLEAN, IO.BOOLEAN,
{ {
@ -375,6 +384,7 @@ class FluxKontextProImageNode(ComfyNodeABC):
input_image: torch.Tensor=None, input_image: torch.Tensor=None,
seed=0, seed=0,
prompt_upsampling=False, prompt_upsampling=False,
safety_tolerance=2,
unique_id: Union[str, None] = None, unique_id: Union[str, None] = None,
**kwargs, **kwargs,
): ):
@ -382,7 +392,7 @@ class FluxKontextProImageNode(ComfyNodeABC):
validate_string(prompt, strip_whitespace=False) validate_string(prompt, strip_whitespace=False)
operation = SynchronousOperation( operation = SynchronousOperation(
endpoint=ApiEndpoint( endpoint=ApiEndpoint(
path="/proxy/bfl/flux-kontext-pro", path="/proxy/bfl/flux-kontext-pro/generate",
method=HttpMethod.POST, method=HttpMethod.POST,
request_model=BFLFluxKontextProGenerateRequest, request_model=BFLFluxKontextProGenerateRequest,
response_model=BFLFluxProGenerateResponse, response_model=BFLFluxProGenerateResponse,
@ -405,6 +415,7 @@ class FluxKontextProImageNode(ComfyNodeABC):
if input_image is None if input_image is None
else convert_image_to_base64(input_image) else convert_image_to_base64(input_image)
), ),
safety_tolerance=safety_tolerance,
), ),
auth_kwargs=kwargs, auth_kwargs=kwargs,
) )