Exemple #1
0
    def run(self, conversation: Conversation):
        from dialog.elements.action import Action
        from dialog.elements.output import Output
        from dialog.elements.get_user_input import GetUserInput
        from dialog.elements.folder import Folder
        from dialog.elements.search import Search
        from dialog.elements.get_user_input import GetUserInputException

        if conversation.flow_position is not None:
            conversation.goto_position = deque(copy(conversation.flow_position))
        conversation.flow_position = []

        if conversation.flow_goto_position is not None:
            # conversation.goto_position = None
            goto_object = self.ref_ids[conversation.flow_goto_position]
            try:
                goto_object.run(conversation)
            except GetUserInputException as get_user_input:
                return get_user_input
            except GotoException as goto_exception:
                return self.run(conversation)
            pass
            # raise NotImplementedError()

        else:

            try:
                self.flow.run(conversation)
            except GotoException as goto_exception:
                return self.run(conversation)
            except GetUserInputException as get_user_input:
                return get_user_input
Exemple #2
0
    def run(self, conversation: Conversation):
        conversation.flow_position = []
        conversation.flow_goto_position = self.ref
        if self.ref in self.dialog.ref_ids:
            goto_object = self.dialog.ref_ids[self.ref]
            raise GotoException(conversation)

        else:
            raise Exception("can not find,id=%s" % self.ref)
Exemple #3
0
    def run(self, conversation: Conversation):
        conversation.flow_position = []
        conversation.flow_goto_position = self.ref
        if self.ref in self.dialog.ref_ids:
            goto_object = self.dialog.ref_ids[self.ref]
            raise GotoException(conversation)


        else:
            raise Exception("can not find,id=%s" % self.ref)