@@ -44,10 +44,18 @@ def workflow_api_check(prompt: Dict[str, Dict[str, Any]]):
4444 ), f"The previous node with ID { v [0 ]} in { prompt [x ]} .{ k } is not present in the prompt"
4545
4646
47+ def is_flux_lora_train_workflow (prompt : Dict [str , Dict [str , Any ]]) -> bool :
48+ for x in prompt :
49+ if prompt [x ]["class_type" ] == "InitFluxLoRATraining" :
50+ return True
51+ return False
52+
53+
4754class SearchServiceRouter (Processor ):
4855 def process (
4956 self , prompt : Dict [str , Dict [str , Any ]], last_node_ids : List [str ], ** kwargs
5057 ):
58+
5159 if BIZYAIR_DEV_REQUEST_URL :
5260 return BIZYAIR_DEV_REQUEST_URL
5361
@@ -99,6 +107,13 @@ def validate_input(
99107 self , prompt : Dict [str , Dict [str , Any ]], last_node_ids : List [str ] = [], ** kwargs
100108 ):
101109 assert len (last_node_ids ) == 1
110+ workflow_api_check (prompt )
111+ if (
112+ is_flux_lora_train_workflow (prompt = prompt )
113+ and prompt [last_node_ids [0 ]]["class_type" ] != "InitFluxLoRATraining"
114+ ):
115+ raise RuntimeError ("Only support invoker InitFluxLoRATraining " )
116+
102117 return True
103118
104119
@@ -124,18 +139,6 @@ def process(
124139 last_node_ids : List [str ],
125140 ** kwargs ,
126141 ):
127- # import requests
128-
129- # out = requests.request(method='POST', url = url, json={
130- # "prompt": prompt,
131- # "exec_info": self._exec_info(prompt),
132- # }, headers=client._headers())
133-
134- # out = requests.request(method='POST', url = url, json={'prompt':prompt, 'exec_info': self._exec_info(prompt)}, headers=client._headers())
135- # # out = requests.request(method='POST', url = 'https://bizyair-api.siliconflow.cn/x/v1/bizy_task/dev-flux-lora-train', json={'prompt':prompt, 'exec_info': self._exec_info(prompt)}, headers=client._headers())
136- # # out = requests.request(method='POST', url = 'https://bizyair-api.siliconflow.cn/x/v1/bizy_task/dev-flux-lora-train', json={'prompt':{'1': 'in'}, 'exec_info': self._exec_info(prompt)}, headers=client._headers())
137-
138- # import ipdb; ipdb.set_trace()
139142 return client .send_request (
140143 url = url ,
141144 data = json .dumps (
@@ -181,18 +184,19 @@ def process(
181184 if node_id in visited :
182185 continue
183186
184- # if str(node_id) in hidden["prompt"]:
185- # for v in hidden["prompt"][str(node_id)].get('inputs', {}).values():
186- # if is_link(v):
187- # # TODO exec
188- # class_type = hidden["prompt"][str(node_id)]["class_type"]
189- # class_def = nodes.NODE_CLASS_MAPPINGS[class_type]
190- # data_type = class_def.RETURN_TYPES[v[1]]
191- # if is_send_request_datatype(data_type):
192- # continue
193- # upstream_node_id = int(v[0])
194- # if upstream_node_id not in visited:
195- # queue.append(upstream_node_id)
187+ if str (node_id ) in hidden ["prompt" ]:
188+ for v in hidden ["prompt" ][str (node_id )].get ("inputs" , {}).values ():
189+ if is_link (v ):
190+ # TODO exec
191+ upstream_node_id = int (v [0 ])
192+ class_type = hidden ["prompt" ][v [0 ]]["class_type" ]
193+ class_def = nodes .NODE_CLASS_MAPPINGS [class_type ]
194+ data_type = class_def .RETURN_TYPES [v [1 ]]
195+ print (f"ID{ upstream_node_id } { class_type } { data_type = } " )
196+ if is_send_request_datatype (data_type ):
197+ continue
198+ if upstream_node_id not in visited :
199+ queue .append (upstream_node_id )
196200
197201 visited .add (node_id )
198202 # https://docs.comfy.org/essentials/javascript_objects_and_hijacking#workflow
@@ -233,9 +237,6 @@ def process(
233237 "last_node_id" : last_node_id ,
234238 }
235239 )
236-
237- # TODO remove hidden keys
238- workflow_api_check (pre_prompt )
239240 return pre_prompt
240241
241242 def validate_input (
0 commit comments