Skip to content

Make videos on the computer you already own. FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM, and adapts its acceleration path to your hardware.

Read an unset second-pass or continue-from input as empty: one shared reader in the engine and...

Bowen Xuedc861af482c2
diff --git a/freevideo_engine/comfy_bridge.py b/freevideo_engine/comfy_bridge.py
index bcd7740..c87f6b4 100644
--- a/freevideo_engine/comfy_bridge.py
+++ b/freevideo_engine/comfy_bridge.py
@@ -1171,6 +1171,8 @@ def generate(prompt, width, height, seconds, seed, output_directory, *,
raise ValueError('Force regeneration must be a boolean')
if type(preview) is not bool:
raise ValueError('Preview must be a boolean')
+ from .comfy_continuation import optional_text
+ refine_from = optional_text(refine_from)
refine_from = refine_from if isinstance(refine_from, str) and refine_from.strip() else None
upscale = None
if refine_from:
diff --git a/freevideo_engine/comfy_continuation.py b/freevideo_engine/comfy_continuation.py
index 115fd1c..ccbcea2 100644
--- a/freevideo_engine/comfy_continuation.py
+++ b/freevideo_engine/comfy_continuation.py
@@ -5,6 +5,24 @@ from .continuation import (INVALID_FILE, INVALID_FRAMES, LEAD_IN_SAMPLES,
LEAD_IN_FADE, LEAD_IN_RATE)
+# ComfyUI turns an empty string widget into str(None) when a saved workflow or an API
+# client leaves it out, so these spellings all mean "not set". Real paths are untouched.
+EMPTY_TEXT = frozenset(('none', 'null', 'undefined'))
+
+
+def optional_text(value):
+ """The one place an optional text input (refine_from, continue_from) is read as set or not.
+
+ None, blank text and "None"/"null"/"undefined" (any case) become ''; any other
+ value is returned unchanged so later validation still rejects what is not a path.
+ """
+ if value is None:
+ return ''
+ if isinstance(value, str) and (not value.strip() or value.strip().lower() in EMPTY_TEXT):
+ return ''
+ return value
+
+
def request_frames(value):
"""Translate the node's duration sentinel into the bridge's optional count."""
if type(value) is not int or value != 0 and (value < 39 or (value - 5) % 17):
@@ -49,6 +67,7 @@ def resolve_continue_from(value, output_directory, input_directory):
def request_options(continue_from='', frames=0):
count = request_frames(frames)
+ continue_from = optional_text(continue_from)
if not isinstance(continue_from, str):
raise ValueError(INVALID_FILE)
previous = None
diff --git a/freevideo_engine/comfy_nodes.py b/freevideo_engine/comfy_nodes.py
index c217c4c..289a43f 100644
--- a/freevideo_engine/comfy_nodes.py
+++ b/freevideo_engine/comfy_nodes.py
@@ -5,7 +5,7 @@ from pathlib import Path
from comfy_api.latest import ComfyExtension, InputImpl, io, ui
from . import comfy_bridge
-from .comfy_continuation import request_options
+from .comfy_continuation import optional_text, request_options
from .default_prompt import DEFAULT_PROMPT
References = io.Custom('FREEVIDEO_REFERENCES')
@@ -76,6 +76,7 @@ class FreeVideoGenerate(io.ComfyNode):
@classmethod
def validate_inputs(cls, text, width, height, seconds, seed, **kwargs):
+ refine_from = optional_text(kwargs.get('refine_from'))
try:
options = request_options(kwargs.get('continue_from', ''), kwargs.get('frames', 0))
if options.get('continue_from'):
@@ -90,9 +91,9 @@ class FreeVideoGenerate(io.ComfyNode):
for key in ('first', 'last', 'conditioning_info'):
media[key] = media[key] or bool(assets.get(key))
options.update(two_pass=kwargs.get('two_pass', True), preview=kwargs.get('preview', False),
- refine_from=kwargs.get('refine_from'), media=media)
+ refine_from=refine_from or None, media=media)
comfy_bridge.validate_request(text, width, height, seconds, seed, **options)
- if not kwargs.get('refine_from'):
+ if not refine_from:
from .two_pass import validate_steps
validate_steps(kwargs.get('base_steps', 8), kwargs.get('refine_steps', 3), kwargs.get('two_pass', True))
if kwargs.get('preview') and not kwargs.get('two_pass', True):
@@ -115,6 +116,7 @@ class FreeVideoGenerate(io.ComfyNode):
continue_from='', frames=0, first_frame_reference=False, voice_reference=False, hide_tail=False):
from server import PromptServer
from .comfy_chain import block_context, block_finished, report_fields
+ refine_from, continue_from = optional_text(refine_from), optional_text(continue_from)
node_id = cls.hidden.unique_id
chain = block_context(PromptServer.instance, node_id)
options = request_options(continue_from, frames)
diff --git a/web/optional_inputs.js b/web/optional_inputs.js
index 1ce5dcf..4309150 100644
--- a/web/optional_inputs.js
+++ b/web/optional_inputs.js
@@ -2,11 +2,19 @@
// shape. A workflow restored from an older version, or a widget list that moved,
// can leave an empty or missing value in them, and Comfy then rejects the whole
// request. Keep each of them to a value the server accepts.
-const DEFAULTS = {continue_from: '', frames: 0, first_frame_reference: false};
+const DEFAULTS = {refine_from: '', continue_from: '', frames: 0, first_frame_reference: false};
+
+// Comfy turns a missing text value into the string "None" on its way to the server,
+// so those spellings are an unset path here too. Mirrors optional_text in the engine.
+function optionalText(value) {
+ if (typeof value !== 'string') return '';
+ const text = value.trim().toLowerCase();
+ return !text || ['none', 'null', 'undefined'].includes(text) ? '' : value;
+}
export function optionalInputValue(name, value) {
if (name === 'frames') return Number.isSafeInteger(value) && value >= 0 ? value : 0;
- if (name === 'continue_from') return typeof value === 'string' ? value : '';
+ if (name === 'refine_from' || name === 'continue_from') return optionalText(value);
if (name === 'first_frame_reference') return value === true;
return value;
}