[英]Alexa Node.js skill not getting into intent
開發一個演示,其中將要通過語音命令控制硬件,隨后是Node.ja示例,該示例在我在Service Simulator中進行測試時可以正常運行,但是當我回顯點時,意圖沒有被發現,以為我缺少會話,我不確定在這里怎么辦
這是index.js
"use strict";
var http = require('http');
var request = require('request');
var Alexa = require("alexa-sdk");
var appId = "amzn1.ask.skill.91bca194-194a-4ca8-92c1-XXXXSDE";
exports.handler = function(event, context, callback) {
var alexa = Alexa.handler(event, context);
alexa.APP_ID = appId;
alexa.registerHandlers(handlers);
alexa.execute();
};
var handlers = {
"LaunchRequest": function () {
this.emit(':tell', 'Welcome home');
},
"CloseIntent": function () {
console.log("Gets into CloseIntent");
this.emit(':tell', "The gate is closed");
},
"OpenIntent": function () {
console.log("Gets into OpenIntent");
this.emit(':tell', "The gate is open");
},
"HelloIntent": function () {
this.emit(':tell', "Hello Welcome ");
},
"AboutIntent": function () {
this.emit(':tell', "The ONLY complete products");
}
};
這是我的意圖模式
{
"intents": [
{
"intent": "HelloIntent"
},
{
"intent": "OpenIntent"
},
{
"intent": "CloseIntent"
},
{
"intent": "AboutIntent"
}
]
}
這是因為當你發出tell
響應, ask-node-sdk
將包括"shouldEndSession": true
的響應JSON這又將結束當前會話。 而不是tell
使用ask
,它將包括"shouldEndSession": false
並等待用戶響應。
'AMAZON.HelpIntent': function () {
this.emit(':ask', 'insert speech here', 'insert re-prompt here');
},
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.