bizyengine 1.2.40__py3-none-any.whl → 1.2.41__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,22 @@ import bizyengine.core as bizyair
8
8
  from bizyengine.core.common.env_var import BIZYAIR_DEBUG
9
9
  from bizyengine.core.data_types import BIZYAIR_TYPE_MAP
10
10
 
11
+ # Invert BIZYAIR_TYPE_MAP for reverse lookup
12
+ INVERTED_BIZYAIR_TYPE_MAP = {v: k for k, v in BIZYAIR_TYPE_MAP.items()}
13
+
14
+ import importlib
15
+ import warnings
16
+
17
+ try:
18
+ comfy_nodes = importlib.import_module("nodes")
19
+ except ModuleNotFoundError:
20
+ warnings.warn("Importing comfyui.nodes failed!")
21
+ comfy_nodes = type(
22
+ "nodes",
23
+ (object,),
24
+ {"NODE_DISPLAY_NAME_MAPPINGS": {}, "NODE_CLASS_MAPPINGS": {}},
25
+ )
26
+
11
27
 
12
28
  def get_bizyair_display_name(class_type: str) -> str:
13
29
  bizyair_cls_prefix = bizyair.nodes_base.PREFIX
@@ -15,35 +31,69 @@ def get_bizyair_display_name(class_type: str) -> str:
15
31
  return f"{bizyair_logo}{bizyair_cls_prefix} {bizyair.NODE_DISPLAY_NAME_MAPPINGS.get(class_type, class_type)}"
16
32
 
17
33
 
18
- def workflow_convert(inputs: dict):
34
+ def revert_bizyair_display_name(class_type: str) -> str:
35
+ comfy_class_type = class_type[len(f"{bizyair.nodes_base.PREFIX}_") :]
36
+ return comfy_nodes.NODE_DISPLAY_NAME_MAPPINGS.get(
37
+ comfy_class_type, comfy_class_type
38
+ )
39
+
40
+
41
+ def workflow_convert(inputs: dict, comfy2bizyair: bool = True):
19
42
  nodes = inputs["nodes"]
20
43
  for node in nodes:
21
44
  class_type = node["type"]
22
45
  node_inputs = node.get("inputs")
23
46
  node_outputs = node.get("outputs")
24
- bizyair_cls_type = f"{bizyair.nodes_base.PREFIX}_{class_type}"
25
47
  is_converted = False
26
- if bizyair_cls_type in bizyair.NODE_CLASS_MAPPINGS:
27
- node["type"] = bizyair_cls_type
28
- display_name = get_bizyair_display_name(class_type)
48
+
49
+ # check if the node is a bizyair node
50
+ new_class_type = class_type
51
+ if not comfy2bizyair:
52
+ if (
53
+ len(class_type) > len(f"{bizyair.nodes_base.PREFIX}_")
54
+ and class_type[len(f"{bizyair.nodes_base.PREFIX}_") :]
55
+ in comfy_nodes.NODE_CLASS_MAPPINGS
56
+ ):
57
+ new_class_type = class_type[len(f"{bizyair.nodes_base.PREFIX}_") :]
58
+ elif (
59
+ comfy2bizyair
60
+ and f"{bizyair.nodes_base.PREFIX}_{class_type}"
61
+ in bizyair.NODE_CLASS_MAPPINGS
62
+ ):
63
+ new_class_type = f"{bizyair.nodes_base.PREFIX}_{class_type}"
64
+
65
+ if new_class_type != class_type:
66
+ node["type"] = new_class_type
67
+ display_name = (
68
+ get_bizyair_display_name(class_type)
69
+ if comfy2bizyair
70
+ else revert_bizyair_display_name(class_type)
71
+ )
29
72
  node["properties"]["Node name for S&R"] = display_name
73
+
74
+ type_mapping = (
75
+ BIZYAIR_TYPE_MAP if comfy2bizyair else INVERTED_BIZYAIR_TYPE_MAP
76
+ )
30
77
  if node_inputs:
31
78
  for input_node in node_inputs:
32
79
  input_type = input_node["type"]
33
- input_node["type"] = BIZYAIR_TYPE_MAP.get(input_type, input_type)
80
+ input_node["type"] = type_mapping.get(input_type, input_type)
34
81
  if node_outputs:
35
82
  for output_node in node_outputs:
36
83
  output_type = output_node["type"]
37
- output_node["type"] = BIZYAIR_TYPE_MAP.get(output_type, output_type)
84
+ output_node["type"] = type_mapping.get(output_type, output_type)
85
+
38
86
  is_converted = True
87
+
39
88
  if BIZYAIR_DEBUG:
40
89
  pprint.pprint(
41
90
  {
42
91
  "original_class_type": class_type,
43
- "bizyair_cls_type": bizyair_cls_type,
92
+ "new_class_type": new_class_type,
44
93
  "is_converted": is_converted,
45
94
  }
46
95
  )
96
+
47
97
  return inputs
48
98
 
49
99
 
@@ -51,7 +101,13 @@ def workflow_convert(inputs: dict):
51
101
  async def convert(request):
52
102
  try:
53
103
  data = await request.json()
54
- ret = workflow_convert(data)
104
+ comfy2bizyair = data.get("comfy2bizyair", True)
105
+ ret = workflow_convert(data, comfy2bizyair=comfy2bizyair)
106
+
107
+ # remove "comfy2bizyair" key from the response
108
+ if "comfy2bizyair" in ret:
109
+ del ret["comfy2bizyair"]
110
+
55
111
  return web.Response(
56
112
  text=json.dumps(ret),
57
113
  content_type="application/json",
bizyengine/version.txt CHANGED
@@ -1 +1 @@
1
- 1.2.40
1
+ 1.2.41
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bizyengine
3
- Version: 1.2.40
3
+ Version: 1.2.41
4
4
  Summary: [a/BizyAir](https://github.com/siliconflow/BizyAir) Comfy Nodes that can run in any environment.
5
5
  Author-email: SiliconFlow <yaochi@siliconflow.cn>
6
6
  Project-URL: Repository, https://github.com/siliconflow/BizyAir
@@ -1,5 +1,5 @@
1
1
  bizyengine/__init__.py,sha256=GP9V-JM07fz7uv_qTB43QEA2rKdrVJxi5I7LRnn_3ZQ,914
2
- bizyengine/version.txt,sha256=ieRc7kTZ6hz8JdJRjtnFbjOxruKVZLAcz159-DPNzKg,7
2
+ bizyengine/version.txt,sha256=14oMCP7qyokUFWpNMA8OF-sbwiuToPwd3e8z94cw7ZM,7
3
3
  bizyengine/bizy_server/__init__.py,sha256=SP9oSblnPo4KQyh7yOGD26YCskFAcQHAZy04nQBNRIw,200
4
4
  bizyengine/bizy_server/api_client.py,sha256=t6cwob7hs993oy5WdFcjKtIzfi3S_eUhODdDVv_Hedo,43822
5
5
  bizyengine/bizy_server/errno.py,sha256=1UiFmE2U7r7hCHgsw4-p_YL0VCmTJc9NyYDEbhkanaY,16336
@@ -40,7 +40,7 @@ bizyengine/bizyair_extras/nodes_upscale_model.py,sha256=lrzA1BFI2w5aEPCmNPMh07s-
40
40
  bizyengine/bizyair_extras/nodes_utils.py,sha256=whog_tmV-q7JvLEdb03JL3KKsC7wKe3kImzx_jPaQD8,2613
41
41
  bizyengine/bizyair_extras/nodes_wan_i2v.py,sha256=3XwcxLHmgrihgXDEzcVOjU6VjqnZa3mErINlY014PFA,8435
42
42
  bizyengine/bizyair_extras/nodes_wan_video.py,sha256=aE2JBF0ZT-6BOM0bGu9R4yZ_eMeMnnjCW-YzFe4qg8Q,2804
43
- bizyengine/bizyair_extras/route_bizyair_tools.py,sha256=w04QUWFnavT1zu8ht7Z1WTMlSnn__cO3r5RmiKlcuUQ,2191
43
+ bizyengine/bizyair_extras/route_bizyair_tools.py,sha256=EiP5pS6xoE3tULoNSN2hYZA29vgt7yCErsbRp34gGEg,3898
44
44
  bizyengine/bizyair_extras/nodes_ipadapter_plus/__init__.py,sha256=ECKATm_EKi_4G47-FJI4-3rHO3iiF9FVakfSTE-pooE,36
45
45
  bizyengine/bizyair_extras/nodes_ipadapter_plus/nodes_ipadapter_plus.py,sha256=lOKRem7oiPs8ZkA_p68HxagAgiCSvn3Rk-L4fSXIjyE,54846
46
46
  bizyengine/bizyair_extras/nodes_kolors_mz/__init__.py,sha256=HsCCCphW8q0SrWEiFlZKK_W2lQr1T0UJIJL7gEn37ME,3729
@@ -79,7 +79,7 @@ bizyengine/misc/route_sam.py,sha256=-bMIR2QalfnszipGxSxvDAHGJa5gPSrjkYPb5baaRg4,
79
79
  bizyengine/misc/segment_anything.py,sha256=wNKYwlYPMszfwj23524geFZJjZaG4eye65SGaUnh77I,8941
80
80
  bizyengine/misc/supernode.py,sha256=STN9gaxfTSErH8OiHeZa47d8z-G9S0I7fXuJvHQOBFM,4532
81
81
  bizyengine/misc/utils.py,sha256=deQjBgLAkxIr-NaOMm77TcgBT3ExAp0MFm5ehUJ3CGs,6829
82
- bizyengine-1.2.40.dist-info/METADATA,sha256=-h0_LM-Rbok05CLoxBva4Mgr3qTTsdXP0FqXoEkizvw,675
83
- bizyengine-1.2.40.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
84
- bizyengine-1.2.40.dist-info/top_level.txt,sha256=2zapzqxX-we5cRyJkGf9bd5JinRtXp3-_uDI-xCAnc0,11
85
- bizyengine-1.2.40.dist-info/RECORD,,
82
+ bizyengine-1.2.41.dist-info/METADATA,sha256=H3M0yCeP_Gz6s_izao-RYYhtfwhkrV8jv-UkJqZs-8w,675
83
+ bizyengine-1.2.41.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
84
+ bizyengine-1.2.41.dist-info/top_level.txt,sha256=2zapzqxX-we5cRyJkGf9bd5JinRtXp3-_uDI-xCAnc0,11
85
+ bizyengine-1.2.41.dist-info/RECORD,,