def run(self, dispatcher, tracker, domain, q_names=[]): # dispatcher.utter_template("present_dialogues") dispatcher.utter_message("Ok, let's begin.") dispatcher.output_channel.questionnaireInterrupt = "gad7" return [ConversationPaused()]
def test_json_parse_pause(): # DOCS MARKER ConversationPaused evt = \ { 'event': 'pause', } # DOCS END assert Event.from_parameters(evt) == ConversationPaused()
def run(self, dispatcher, tracker, domain, q_names=[]): # dispatcher.utter_template("present_dialogues") textArray = ["Here are all the questionnaires:", "These are the questionnaires: "] buttons = [{"payload": q, "title": q} for q in q_names] dispatcher.utter_button_message(random.choice(textArray), buttons) return [ConversationPaused()]
def run(self, dispatcher, tracker, domain, d_names=[]): # dispatcher.utter_template("present_dialogues") textArray = ["I can talk about any of these things:", "Here are all the things I know about, choose one!", "Here are all the things we can talk about:"] buttons = [{"payload": d, "title": d} for d in d_names] dispatcher.utter_button_message(random.choice(textArray), buttons) return [ConversationPaused()]
def run(self, dispatcher, tracker, domain): response = "Reaching out to a human agent [{}]...".format( tracker.sender_id) dispatcher.utter_message(response) """ seems like rasa will stop listening once conversation is paused, which means no actions are attempted, therefore preventing triggering ConversationResumed() in a straightforward way. """ tracker.update(ConversationPaused()) message = "" while message != "/unpause": url = "http://127.0.0.1:5000/handoff/{}".format(tracker.sender_id) req = requests.get(url) resp = json.loads(req.text) if "error" in resp: raise Exception("Error fetching message: " + repr(resp["error"])) message = resp["message"] if message != "/unpause": dispatcher.utter_message("Human agent: {}".format(message)) tracker.update(ConversationResumed())
StoryExported, ActionReverted, BotUttered) @pytest.mark.parametrize("one_event,another_event", [ (UserUttered("/greet", { "name": "greet", "confidence": 1.0 }, []), UserUttered("/goodbye", { "name": "goodbye", "confidence": 1.0 }, [])), (TopicSet("my_topic"), TopicSet("my_other_topic")), (SlotSet("my_slot", "value"), SlotSet("my__other_slot", "value")), (Restarted(), None), (AllSlotsReset(), None), (ConversationPaused(), None), (ConversationResumed(), None), (StoryExported(), None), (ActionReverted(), None), (ActionExecuted("my_action"), ActionExecuted("my_other_action")), (BotUttered("my_text", "my_data"), BotUttered("my_other_test", "my_other_data")), (ReminderScheduled("my_action", "now"), ReminderScheduled("my_other_action", "now")), ]) def test_event_has_proper_implementation(one_event, another_event): # equals tests assert one_event != another_event, \ "Same events with different values need to be different" assert one_event == deepcopy(one_event), \ "Event copies need to be the same"
def run(self, dispatcher, tracker, domain, botoutput): dispatcher.utter_message("Ok, let's begin.") dispatcher.output_channel.questionnaireInterrupt = "phq9" return [ConversationPaused()]
(UserUttered("/greet", {"name": "greet", "confidence": 1.0}, []), UserUttered("/goodbye", {"name": "goodbye", "confidence": 1.0}, [])), (TopicSet("my_topic"), TopicSet("my_other_topic")), (SlotSet("my_slot", "value"), SlotSet("my__other_slot", "value")), (Restarted(), None), (AllSlotsReset(), None), (ConversationPaused(), None), (ConversationResumed(), None), (StoryExported(), None), (ActionReverted(), None), (ActionExecuted("my_action"), ActionExecuted("my_other_action")), (BotUttered("my_text", "my_data"),
def run(self, dispatcher, tracker, domain): return [ConversationPaused()]