mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-17 11:00:29 +00:00
Adds regression tests demonstrating that V3 DynamicCombo widget
serialization breaks when nodes are packed into subgraphs. The
serializeValue callback is lost during subgraph conversion, causing
sampling_mode to serialize as the raw string 'on' instead of the
expected {sampling_mode: 'on', temperature: 0.7, top_k: 64} object.
This reproduces the bug where TextGenerateLTX2Prompt -> PreviewAny
text preview fails inside subgraphs.
Tests:
- Unit: graphToPrompt DynamicCombo serialization at top level (pass)
and inside subgraph (intentional fail)
- E2E: DynamicCombo text preview at top level and inside subgraph
- Devtools: Mock V3 DynamicCombo node for CI testing (no model needed)
49 lines
1.4 KiB
Python
49 lines
1.4 KiB
Python
from __future__ import annotations
|
|
|
|
from comfy_api.latest import io # pyright: ignore[reportMissingImports]
|
|
|
|
|
|
class DynamicComboStringOutput(io.ComfyNode):
|
|
@classmethod
|
|
def define_schema(cls):
|
|
sampling_options = [
|
|
io.DynamicCombo.Option(
|
|
key="on",
|
|
inputs=[
|
|
io.Float.Input("temperature", default=0.7, min=0.01, max=2.0),
|
|
io.Int.Input("top_k", default=64, min=0, max=1000),
|
|
],
|
|
),
|
|
io.DynamicCombo.Option(key="off", inputs=[]),
|
|
]
|
|
|
|
return io.Schema(
|
|
node_id="DynamicComboStringOutput",
|
|
category="DevTools",
|
|
inputs=[
|
|
io.String.Input("prompt", multiline=True, default="test input"),
|
|
io.DynamicCombo.Input("sampling_mode", options=sampling_options),
|
|
],
|
|
outputs=[io.String.Output(display_name="output_text")],
|
|
)
|
|
|
|
@classmethod
|
|
def execute(cls, prompt, sampling_mode) -> io.NodeOutput:
|
|
mode = sampling_mode.get("sampling_mode", "unknown")
|
|
return io.NodeOutput(f"DynamicCombo output ({mode}): {prompt}")
|
|
|
|
|
|
NODE_CLASS_MAPPINGS = {
|
|
"DynamicComboStringOutput": DynamicComboStringOutput,
|
|
}
|
|
|
|
NODE_DISPLAY_NAME_MAPPINGS = {
|
|
"DynamicComboStringOutput": "Dynamic Combo String Output",
|
|
}
|
|
|
|
__all__ = [
|
|
"DynamicComboStringOutput",
|
|
"NODE_CLASS_MAPPINGS",
|
|
"NODE_DISPLAY_NAME_MAPPINGS",
|
|
]
|