changed location of early exit
Browse files130 unmodified lines1311321331341351361371381391401411421431441451461341351481491501511521531541551361371381391401411421431441457 unmodified lines1531541551561571581591601611621631641651661671681691701711721731741751761771781796 unmodified lines186187188189190191187192193194195196197198199200201130 unmodified lines self.subflows["Controller"].send_message_async(message, pipe_to= self.flow_config["flow_ref"]) def call_executor(self): #detect and early exit if self.flow_state["command"] == "finish": self._state_update_dict( { "EARLY_EXIT": True, "answer": self.flow_state["command_args"]["answer"], "status": "finished" } ) self.generate_reply() #call executor else: executor_branch_to_call = self.flow_state["command"] message = self._package_input_message( data = self.flow_state["command_args"], dst_flow = executor_branch_to_call ) self.subflows[executor_branch_to_call].send_message_async(message, pipe_to= self.flow_config["flow_ref"]) executor_branch_to_call = self.flow_state["command"] message = self._package_input_message( data = self.flow_state["command_args"], dst_flow = executor_branch_to_call ) self.subflows[executor_branch_to_call].send_message_async(message, pipe_to= self.flow_config["flow_ref"]) def register_data_to_state(self, input_message):7 unmodified lines self.flow_state["observation"] = input_message.data else: self._state_update_dict( { "command": input_message.data["command"], "command_args": input_message.data["command_args"] } ) #detect and early exit if self.flow_state["command"] == "finish": self._state_update_dict( { "EARLY_EXIT": True, "answer": self.flow_state["command_args"]["answer"], "status": "finished" } ) self.flow_state["early_exit_flag"] = True def run(self,input_message: FlowMessage): """ Runs the WikiSearch Atomic Flow. It's used to execute a Wikipedia search and get page summaries.6 unmodified lines flow_to_call = self.get_next_flow_to_call() if self.flow_state.get("early_exit_flag",False): self.generate_reply() if flow_to_call == "Controller": elif flow_to_call == "Controller": self.call_controller() elif flow_to_call == "Executor": self.call_executor() self.flow_state["current_round"] += 1 else: self._on_reach_max_round() self.generate_reply()ControllerExecutorFlow.py+29-22