我正在使用 ask-sdk 版本 2.3.0
const SessionEndedRequest = {
canHandle(handlerInput) {
const request = handlerInput.requestEnvelope.request;
return request.type === 'SessionEndedRequest'
},
handle(handlerInput) {
return handlerInput.responseBuilder.speak("Good bye").withShouldEndSession(true).getResponse();
}
};
const skillBuilder = Alexa.SkillBuilders.custom();
exports.handler = skillBuilder
.addRequestHandlers(
LaunchRequest,
SessionEndedRequest
)
.lambda();
SessionEndedRequest 是当用户说“停止”或“取消”时执行的函数
用户说“取消”时的输出
{
"body": {
"version": "1.0",
"response": {
"outputSpeech": {
"type": "SSML",
"ssml": "<speak>Good bye</speak>"
},
"shouldEndSession": true,
"type": "_DEFAULT_RESPONSE"
},
"sessionAttributes": {},
"userAgent": "ask-node/2.3.0 Node/v8.10.0"
}
}
Alexa的回应是这样的
请求的技能响应有问题