refactor: restore two-port concat backend schema

This commit is contained in:
Gin3601
2026-05-26 11:46:13 +08:00
parent 6926861bc3
commit d9afc48ee5
3 changed files with 15 additions and 8 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ class TestConcatByTargetNode(unittest.TestCase):
self.assertLessEqual(float(image.max().item()), 1.0)
self.assertTrue(torch.allclose(mask, torch.zeros_like(mask)))
def test_new_port_names_are_accepted(self):
def test_legacy_port_names_are_accepted(self):
image_a = self.make_image(width=2, height=2, value=0.2)
image_b = self.make_image(width=1, height=2, value=0.8)
+4 -4
View File
@@ -41,10 +41,10 @@ class TestConcatByTargetRegistration(unittest.TestCase):
self.assertEqual(required["background_value"][1]["default"], 0.0)
self.assertEqual(required["multiple_of"][0], "INT")
self.assertEqual(required["allow_batch_broadcast"][0], "BOOLEAN")
self.assertEqual(optional["image/mask_A"][0], "IMAGE,MASK")
self.assertEqual(optional["image/mask_B"][0], "IMAGE,MASK")
self.assertNotIn("a", optional)
self.assertNotIn("b", optional)
self.assertEqual(str(optional["a"][0]), "*")
self.assertEqual(str(optional["b"][0]), "*")
self.assertNotIn("image/mask_A", optional)
self.assertNotIn("image/mask_B", optional)
self.assertNotIn("image_a", optional)
self.assertNotIn("image_b", optional)
self.assertNotIn("mask_a", optional)
+10 -3
View File
@@ -16,11 +16,18 @@ TARGET_CHOICES = ["A", "B"]
POSITION_CHOICES = ["top", "bottom", "left", "right"]
RESIZE_MODE_CHOICES = ["keep_proportion", "stretch", "none"]
ALIGN_CHOICES = ["start", "center", "end"]
INPUT_DATA_CHOICES = "IMAGE,MASK"
PORT_A_NAME = "image/mask_A"
PORT_B_NAME = "image/mask_B"
class AnyType(str):
def __ne__(self, other): # pragma: no cover - exercised by ComfyUI type checks
return False
ANY_TYPE = AnyType("*")
def _require_torch():
if torch is None or torch_nn_functional is None:
raise RuntimeError("[LLS] torch is required for LLS Concat By Target.") from _TORCH_ERR
@@ -452,8 +459,8 @@ class LLSConcatByTarget:
"allow_batch_broadcast": ("BOOLEAN", {"default": True}),
},
"optional": {
PORT_A_NAME: (INPUT_DATA_CHOICES,),
PORT_B_NAME: (INPUT_DATA_CHOICES,),
"a": (ANY_TYPE,),
"b": (ANY_TYPE,),
},
}