changed location of early exit
Browse files130 unmodified lines1311321331341351361371381391401411421431441451461471481491501511521531541551561571587 unmodified lines1661671681691701711721731741751761776 unmodified lines184185186187188189190191192193194130 unmodified linesself.subflows["Controller"].send_message_async(message, pipe_to= self.flow_config["flow_ref"])def call_executor(self):#detect and early exitif 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 executorelse: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 linesself.flow_state["observation"] = input_message.dataelse:self._state_update_dict({"command": input_message.data["command"],"command_args": input_message.data["command_args"]})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 linesflow_to_call = self.get_next_flow_to_call()if flow_to_call == "Controller":self.call_controller()elif flow_to_call == "Executor":self.call_executor()self.flow_state["current_round"] += 1else:self._on_reach_max_round()self.generate_reply()130 unmodified lines1311321331341351361371381391401411421431441457 unmodified lines1531541551561571581591601611621631641651661671681691701711721731741751761771781796 unmodified lines186187188189190191192193194195196197198199200201130 unmodified linesself.subflows["Controller"].send_message_async(message, pipe_to= self.flow_config["flow_ref"])def call_executor(self):#call executorexecutor_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 linesself.flow_state["observation"] = input_message.dataelse:self._state_update_dict({"command": input_message.data["command"],"command_args": input_message.data["command_args"]})#detect and early exitif 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"] = Truedef run(self,input_message: FlowMessage):""" Runs the WikiSearch Atomic Flow. It's used to execute a Wikipedia search and get page summaries.6 unmodified linesflow_to_call = self.get_next_flow_to_call()if self.flow_state.get("early_exit_flag",False):self.generate_reply()elif flow_to_call == "Controller":self.call_controller()elif flow_to_call == "Executor":self.call_executor()self.flow_state["current_round"] += 1else:self._on_reach_max_round()self.generate_reply()
ControllerExecutorFlow.py+29-22