最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

因此Alexa中的“OnIntent:function”是什么?

运维笔记admin18浏览0评论

因此Alexa中的“OnIntent:function”是什么?

因此Alexa中的“OnIntent:function”是什么?

AlexaSkill.prototype.eventHandlers = {
    OnSessionStarted: function(sessionStartedRequest, session){
    },
    OnLaunch: function(launchRequest, session, response){
     throw: "OnLaunch should be overriden by subclass";
     },
    OnIntent: function(intentRequest, session, response){
       var intent = intentRequest.intent,
           intentName = intenRequest.intent.name,
           intentHandler = this.intentHandler(intentName);
    if (intentHandler){
        console.log('dispatch intent =' + intenRequest);
        intentHandl.ercall(this,intent, session,session);
    } else {
        throw 'Unsupported intent =' + intenName;
    }
},
    OnSessionEnded: function(sessionEndedRequest,session){
     }
};

仍然试图找出这个OnIntent在这个事件Handler中做了什么;

因此它(在会话中),“Alexa,请求调用,然后是话语”(只是混淆 你必须再次询问Alexa(启动?)会话你的Awaking Alexa再次)

或者只是故事技巧中的三条路线(路径一,路径二,路径三)

我也做了删除它,并尝试看它是否有效,但事实并非如此

祝福和爱

KC.D

回答如下:

Alexa技能套件中的“onIntent”功能是Alexa语音服务与您正在构建的技能之间的中间层。它采用“意图”(用户根据您的Sample Utterances请求的内容)并将其传递给您自己代码中的匹配函数。

您可以在Amazon的示例“Hello World”代码中看到一些intentHandlers的示例:https://github/amzn/alexa-skills-kit-js/blob/6c59448d8bb2701433ab7e117574199012bedd3f/helloWorld/src/index.js#L64-L72

这里还有一个很棒的Skills Kit演练(包括你问题中的代码):http://tobuildsomething/2015/08/14/Amazon-Alexa-JavaScript-SDK-The-Ultimate-Guide/

对于多次唤醒Alexa的担忧:亚马逊提供了用户请求的完整细分:https://developer.amazon/docs/custom-skills/understanding-how-users-invoke-custom-skills.html

我强烈推荐那里的其他文档以及介绍教程。这将有助于使您与用户的互动方式更加清晰。

发布评论

评论列表(0)

  1. 暂无评论