繁体   English   中英

Alexa Node.js技能无法达到目的

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM