Beispiel #1
0
    def handle(self, handler_input):
        # type: (HandlerInput) -> Response

        logging.info("Here comes some sweet intent requests:")
        logging.info(handler_input.request_envelope.to_dict())

        # TODO: check this out
        # can_fulfill = CanFulfillIntent(CanFulfillIntentValues.YES)
        # if is_intent_name("ChangePlatformsIntent")(handler_input):
        can_fulfill = CanFulfillIntent(CanFulfillIntentValues.NO)

        return handler_input.response_builder.set_can_fulfill_intent(
            can_fulfill).response
Beispiel #2
0
 def build_response(self):
     return self.response_builder.set_can_fulfill_intent(
         CanFulfillIntent(
             can_fulfill=self.can_fulfill_intent_text
             or CanFulfillIntentValues.NO,
             slots={
                 slot["name"]: CanFulfillSlot(
                     can_understand=slot["can_understand"],
                     can_fulfill=slot["can_fulfill"],
                 )
                 for slot in self.slots_fulfillment
             },
         )).response
    def test_set_can_fulfill_intent(self):
        intent = CanFulfillIntent(
            can_fulfill=CanFulfillIntentValues.MAYBE,
            slots={
                "testSlot":
                CanFulfillSlot(can_understand=CanUnderstandSlotValues.YES,
                               can_fulfill=CanFulfillSlotValues.YES)
            })
        response_factory = self.response_factory.set_can_fulfill_intent(
            can_fulfill_intent=intent)

        assert response_factory.response.can_fulfill_intent == intent, (
            "The set_can_fulfill_intent method of ResponseFactory fails to "
            "set can_fulfill_intent value")