22
33import time
44
5+ from comfy_api .v0_0_2 import IO
6+
57
68class LongComboDropdown :
79 @classmethod
@@ -317,6 +319,30 @@ def INPUT_TYPES(cls):
317319 def node_with_legacy_widget (self ):
318320 return ()
319321
322+ class NodeWithPriceBadge (IO .ComfyNode ):
323+ @classmethod
324+ def define_schema (cls ):
325+ return IO .Schema (
326+ node_id = "DevToolsNodeWithPriceBadge" ,
327+ display_name = "Node With Price Badge" ,
328+ description = "An API node with a price badge" ,
329+ inputs = [IO .Combo .Input ("price" , options = ["1x" , "2x" , "3x" ])],
330+ is_api_node = True ,
331+ price_badge = IO .PriceBadge (
332+ depends_on = IO .PriceBadgeDepends (widgets = ["price" ]),
333+ expr = """
334+ (
335+ $p := widgets.price;
336+ {"type":"usd","usd": $contains($p, "2x") ? 2 : $contains($p, "3x") ? 3 : 1}
337+ )
338+ """ ,
339+ ),
340+ )
341+
342+ @classmethod
343+ async def execute (cls , price ):
344+ return IO .NodeOutput ()
345+
320346
321347NODE_CLASS_MAPPINGS = {
322348 "DevToolsLongComboDropdown" : LongComboDropdown ,
@@ -334,6 +360,7 @@ def node_with_legacy_widget(self):
334360 "DevToolsNodeWithValidation" : NodeWithValidation ,
335361 "DevToolsNodeWithV2ComboInput" : NodeWithV2ComboInput ,
336362 "DevToolsNodeWithLegacyWidget" : NodeWithLegacyWidget ,
363+ "DevToolsNodeWithPriceBadge" : NodeWithPriceBadge ,
337364}
338365
339366NODE_DISPLAY_NAME_MAPPINGS = {
@@ -352,6 +379,7 @@ def node_with_legacy_widget(self):
352379 "DevToolsNodeWithValidation" : "Node With Validation" ,
353380 "DevToolsNodeWithV2ComboInput" : "Node With V2 Combo Input" ,
354381 "DevToolsNodeWithLegacyWidget" : "Node With Legacy Widget" ,
382+ "DevToolsNodeWithPriceBadge" : "Node With Price Badge" ,
355383}
356384
357385__all__ = [
0 commit comments