可能的原因是意图名称或语句没有匹配到Alexa技能的语句模型。您可以尝试以下方法,以确保意图已正确定义且语句模型正确匹配:
在您的Alexa技能代码中,检查是否定义了正确的意图名称和对应的处理程序函数。
确保在您的语句模型中包含了与您的意图名称相对应的用户语句和示例。在语句模型中,例如:
{
"intents": [
{
"name": "MyIntent",
"samples": [
"sample one",
"sample two"
]
}
]
}
{
"intents": [
{
"name": "MyIntent",
"slots": [
{
"name": "mySlot",
"type": "AMAZON.Color"
}
],
"samples": [
"my favorite color is {mySlot}",
"I like {mySlot}"
]
}
]
}
const MyIntentHandler = {
canHandle(handlerInput) {
return handlerInput.requestEnvelope.request.type === 'IntentRequest' &&
handlerInput.requestEnvelope.request.intent.name === 'MyIntent';
},
handle(handlerInput) {
const speechText = 'Hello from MyIntentHandler';
return handlerInput.responseBuilder
.speak(speechText)
.getResponse();
}
};