我正在尝试使用对话委托。我正在 Alexa Dev 控制台工作。在 EditContactDetailsIntent 中启用自动对话委派。下面有 2 个处理程序 EditContactDetailsIntentHandler 和 InProgressEditContactDetailsIntentHandler,但在尝试启动上述意图序列时出现一个奇怪的错误,该序列在 CloudWatch 日志中没有任何痕迹:
{
"type": "INTERNAL_SERVICE_ERROR",
"message": "Can't find skill bundle metadata for skillId amzn1.ask.skill.GUID_HERE locale en-GB stage development"
}
2 个处理程序:
class EditContactDetailsIntentHandler(AbstractRequestHandler):
def can_handle(self, handler_input):
return (ask_utils.is_intent_name("EditContactDetailsIntent")(handler_input) and
ask_utils.request_util.get_dialog_state(handler_input) == "COMPLETED")
def handle(self, handler_input):
speak_output = "This is EditContactDetailsIntent initiated when phone number is complete."
return (
handler_input.response_builder
.speak(speak_output)
.ask(speak_output)
.response
)
class InProgressEditContactDetailsIntentHandler(AbstractRequestHandler):
def can_handle(self, handler_input):
# type: (HandlerInput) -> bool
return (
ask_utils.is_intent_name("EditContactDetailsIntent")(handler_input) and
ask_utils.request_util.get_dialog_state(handler_input) != "COMPLETED"
)
def handle(self, handler_input):
currentIntent = handler_input.request_envelope.request.intent
return (
handler_input.response_builder
.add_delegate_directive(currentIntent)
.response
)
要解决该问题,请在 Alexa 开发者控制台的 JSON 编辑器中找到以下 JSON 块:
"dialog": {
"intents": [
{
"name": "TechSupportAppointmentIntent",
"delegationStrategy": "ALWAYS",
"confirmationRequired": false,
"prompts": {},
"slots": [
{
"name": "appointmentDate",
"type": "AMAZON.DATE",
"confirmationRequired": false,
"elicitationRequired": true,
"prompts": {
"elicitation": "Elicit.Slot.5137408571304957813049571345134513451345.1617658477706"
}
},
{
"name": "appointmentTime",
"type": "AMAZON.TIME",
"confirmationRequired": false,
"elicitationRequired": false,
"prompts": {}
}
]
}
],
"delegationStrategy": "ALWAYS"
}
如果您发现此块,请尝试将其删除。执行此操作后,保存更改并再次测试该技能,看看是否可以解决问题。如果自动委派或提示干扰意图功能,删除对话框配置有时会有所帮助。