@@ -93,6 +93,7 @@ def load_input_file(file_path: str):
9393setup_comfyui_env ()
9494initialize_comfyui ()
9595import bizyair
96+ from bizyair .data_types import BIZYAIR_TYPE_MAP
9697
9798
9899def get_args ():
@@ -111,8 +112,6 @@ def main():
111112 with open (args .output , "w" ) as f :
112113 json .dump (out , f )
113114
114- # pprint.pprint({"status": "success"})
115-
116115
117116def get_bizyair_display_name (class_type : str ) -> str :
118117 bizyair_cls_prefix = bizyair .nodes_base .PREFIX
@@ -145,12 +144,15 @@ def workflow_convert(inputs: dict):
145144 if node_inputs :
146145 for input_node in node_inputs :
147146 input_type = input_node ["type" ]
148- input_node ["type" ] = f" { bizyair . nodes_base . PREFIX } _ { input_type } "
147+ input_node ["type" ] = BIZYAIR_TYPE_MAP . get ( " input_type" , input_type )
149148
150149 if node_outputs :
151150 for output_node in node_outputs :
152151 output_type = output_node ["type" ]
153- output_node ["type" ] = f"{ bizyair .nodes_base .PREFIX } _{ output_type } "
152+ output_node ["type" ] = BIZYAIR_TYPE_MAP .get (
153+ "output_type" , output_type
154+ )
155+
154156 is_converted = True
155157 pprint .pprint (
156158 {
@@ -186,35 +188,6 @@ def workflow_api_convert(inputs: dict):
186188 return inputs
187189
188190
189- def patch_apply (inputs : dict , yaml_file ):
190- replacements = load_yaml_replacements (yaml_file )
191- for replacement in replacements ["node_replacements" ]:
192-
193- original_type = replacement ["original_type" ]
194- replace_type = replacement ["replace_type" ]
195-
196- for node in inputs ["nodes" ]:
197- if "type" in node and node ["type" ] == original_type :
198- node ["type" ] = replace_type
199-
200- display_name = get_bizyair_display_name (replace_type )
201- node ["properties" ]["Node name for S&R" ] = display_name
202-
203- node_inputs = node .get ("inputs" )
204- if node_inputs :
205- for input_node in node_inputs :
206- input_type = input_node ["type" ]
207- input_node ["type" ] = f"{ bizyair .nodes_base .PREFIX } _{ input_type } "
208-
209- node_outputs = node .get ("outputs" )
210- if node_outputs :
211- for output_node in node_outputs :
212- output_type = output_node ["type" ]
213- output_node ["type" ] = f"{ bizyair .nodes_base .PREFIX } _{ output_type } "
214-
215- return inputs
216-
217-
218191def convert_to_bizyair (inputs : dict , yaml_file ):
219192 bizyair .NODE_CLASS_MAPPINGS
220193
@@ -224,17 +197,8 @@ def convert_to_bizyair(inputs: dict, yaml_file):
224197 elif input_format == "workflow" :
225198 inputs = workflow_convert (inputs )
226199
227- if yaml_file :
228- inputs = patch_apply (inputs , yaml_file )
229-
230200 return inputs
231201
232202
233- def load_yaml_replacements (yaml_file ):
234- with open (yaml_file , "r" ) as file :
235- replacements = yaml .safe_load (file )
236- return replacements
237-
238-
239203if __name__ == "__main__" :
240204 main ()
0 commit comments