【问题标题】:Alexa Node.js skill not getting into intentAlexa Node.js 技能没有进入意图
【发布时间】:2017-07-13 15:04:40
【问题描述】:

开发一个我将通过语音命令控制硬件的演示,然后是一个 Node.ja 示例,当我在服务模拟器中测试时它工作正常,但是当我来到 echo dot 时,意图没有被识别,认为我是缺少会话,我不知道我怎么能在这里做到这一点

这是 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"
    }
  ]
}

【问题讨论】:

  • 您是否可能没有为您的意图提供足够的示例话语?
  • 我提供了示例话语,我解决了问题,实际上是我错过了调用名称
  • 只是一个提示:alexa.APP_ID 应该是 alexa.appID 根据文档

标签: node.js alexa alexa-skills-kit alexa-skill


【解决方案1】:

这是因为当您发出 tell 响应时,ask-node-sdk 将在响应 JSON 中包含 "shouldEndSession": true,这反过来又会结束当前会话。使用 ask 代替 tell,其中将包含 "shouldEndSession": false 并等待用户响应。

'AMAZON.HelpIntent': function () {    
     this.emit(':ask', 'insert speech here', 'insert re-prompt here');
},

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多