要解决Ask CLI模拟未解析技能返回IntentForDifferentSkill错误的问题,您可以执行以下步骤:
const HelloWorldIntentHandler = {
canHandle(handlerInput) {
return Alexa.getRequestType(handlerInput.requestEnvelope) === 'IntentRequest'
&& Alexa.getIntentName(handlerInput.requestEnvelope) === 'HelloWorldIntent';
},
handle(handlerInput) {
const speakOutput = 'Hello, World!';
return handlerInput.responseBuilder
.speak(speakOutput)
.getResponse();
}
};
{
"intents": [
{
"name": "HelloWorldIntent",
"samples": [
"say hello",
"greet me"
]
}
],
"handlers": {
"HelloWorldIntent": "HelloWorldIntentHandler"
}
}
ask init
ask simulate -t "open my skill"
这将模拟一个未解析的技能请求,并返回IntentForDifferentSkill错误。
通过执行以上步骤,您应该能够解决Ask CLI模拟未解析技能返回IntentForDifferentSkill错误的问题。