def run(self, dispatcher: 'Dispatcher', tracker: 'DialogueStateTracker', domain: 'Domain') -> List[Event]: from rasa_core.policies.two_stage_fallback import has_user_rephrased revert_events = [] # User rephrased if has_user_rephrased(tracker): revert_events = _revert_successful_rephrasing(tracker) # User affirmed elif has_user_affirmed(tracker): revert_events = _revert_affirmation_events(tracker) return revert_events
def run(self, dispatcher: 'Dispatcher', tracker: 'DialogueStateTracker', domain: 'Domain') -> List[Event]: from rasa_core.policies.two_stage_fallback import (has_user_rephrased, has_user_affirmed) last_user_event = tracker.latest_message.intent.get('name') revert_events = [] # User affirmed if has_user_affirmed(last_user_event, tracker): revert_events = _revert_affirmation_events(tracker) # User rephrased elif has_user_rephrased(tracker): revert_events = _revert_successful_affirmation(tracker) # User rephrased instead of affirming elif tracker.last_executed_action_has( ACTION_DEFAULT_ASK_AFFIRMATION_NAME): revert_events = _revert_early_rephrasing(tracker) return revert_events