@@ -82,6 +82,17 @@ def _coerce_float(value: Any, default: float) -> float:
8282 if isinstance (value , str ):
8383 return float (value ) if value .strip () else default
8484 return float (value )
85+
86+
87+ def _coerce_int (value : Any , default : int ) -> int :
88+ """Return *value* as an int, falling back to *default* for empty strings.
89+
90+ Older ComfyUI workflows may store optional INT widget values as ``""``
91+ instead of the numeric default when the field was not explicitly set.
92+ """
93+ if isinstance (value , str ):
94+ return int (value ) if value .strip () else default
95+ return int (value )
8596def _binary_in_build (build_dir : str , name : str ) -> Optional [str ]:
8697 """Return the path to *name* if it exists in *build_dir* or *build_dir*/bin.
8798
@@ -1182,10 +1193,13 @@ def generate(
11821193 # Merge options dict (from AcestepCPPOptions) with defaults.
11831194 opts : Dict [str , Any ] = options or {}
11841195
1185- # Coerce optional FLOAT inputs that may arrive as empty strings from
1196+ # Coerce optional numeric inputs that may arrive as empty strings from
11861197 # workflows saved with an older version of the node schema.
11871198 lm_top_p = _coerce_float (lm_top_p , 0.9 )
1199+ lm_top_k = _coerce_int (lm_top_k , 0 )
11881200 audio_cover_strength = _coerce_float (audio_cover_strength , 0.5 )
1201+ repainting_start = _coerce_float (repainting_start , - 1.0 )
1202+ repainting_end = _coerce_float (repainting_end , - 1.0 )
11891203
11901204 # Apply instrumental convenience toggle: overrides lyrics to [Instrumental]
11911205 # only when the lyrics field is empty (user-provided lyrics take priority).
0 commit comments