【发布时间】:2019-06-06 14:33:41
【问题描述】:
在我的交互模型中,我定义了一个名为 city 的插槽,它是可选的,不是必需的,以实现一个意图。
我正在使用 python ask sdk,所以我的处理程序是这样的:
class IntentHandler(RequestHandler):
"""
Intent handler
"""
def can_handle(self, handler_input):
# type: (HandlerInput) -> bool
return is_request_type("IntentRequest")(handler_input) and \
is_intent_name("ExampleIntent")(handler_input)
def handle(self, handler_input):
# type: (HandlerInput) -> Response
access_token = handler_input.request_envelope.context.system.user.access_token
if access_token is None:
raise Exception("no access_token provided")
speech = RESPONSE_MESSAGE_DEFAULT
handler_input.response_builder.speak(speech)
return handler_input.response_builder.response
如何检查槽是否被用户填满以及如何获取其值?
【问题讨论】:
标签: python alexa alexa-skills-kit alexa-skill alexa-slot