示例#1
0
    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()]
示例#2
0
def test_json_parse_pause():
    # DOCS MARKER ConversationPaused
    evt = \
        {
            'event': 'pause',
        }
    # DOCS END
    assert Event.from_parameters(evt) == ConversationPaused()
示例#3
0
    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()]
示例#4
0
    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()]
示例#5
0
    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())
示例#6
0
                              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"
示例#7
0
    def run(self, dispatcher, tracker, domain, botoutput):

        dispatcher.utter_message("Ok, let's begin.")
        dispatcher.output_channel.questionnaireInterrupt = "phq9"

        return [ConversationPaused()]
示例#8
0
    (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"),
示例#9
0
文件: actions.py 项目: jpvgc45/botj
    def run(self, dispatcher, tracker, domain):

        return [ConversationPaused()]