小编Ing*_*rid的帖子

Alexa Skill - 如何检索Lambda函数中的槽值

我正在开发一个带有一个Intent的Alexa技能,其中包含一个带有几个可能值的Slot.

我的槽与所定义"name" : "Channel","type" : "LIST_OF_CHANNELS"和值

  1. iqram
  2. 英格丽
  3. 菲尔
  4. 克莱德

如何检索要在Lambda函数中使用的发出的槽值?这是"从话语部分检索插槽的价值"我希望得到回答.非常感谢.

 // retrieve value of slot from utterance     
 var c = intent.slots.Channel.value; 

 // append value to end of URL that references API
 fetchEnseParse("/channel/" + c, function(body) {

 // continuation of this function is below 
Run Code Online (Sandbox Code Playgroud)

alexa aws-lambda alexa-skills-kit

6
推荐指数
2
解决办法
8804
查看次数

Alexa技能套件的AudioPlayer“ PlaybackNearlyFinished”请求不起作用

我编写了Alexa技能,该技能使用Lambda函数播放给定URL中的独特音频。

名为“ PlayAudio”的Intent正在运行,并播放我们JSON格式的API中的第一个音频项目。

名为“ PlaybackNearlyFinished”的Intent无法正常运行,也就是无法播放我正在馈送的音频文件。谁能确切解释为什么这行不通?

这是我的Lambda函数的一部分,其中包含两个Intent:

Fact.prototype.intentHandlers = {
    "PlayAudio": function (event, context, response) {
          fetchEnseParse("/latest", function(body) {
            if(body == "error") {
            } 
            else {
                var directives = body.enses.map(function(ense) {
                    var a = ense[1].fileUrl;
                    return {
                         'playBehavior': 'REPLACE_ALL', 
                         'audioItem': 
                             {
                                 'stream': 
                                     {
                                         'url': 'https://s3.amazonaws.com/media.ense.nyc/enses/2017_01_13T16_57_20.190Z/30312/0', 
                                         'token': '33529', 
                                         'offsetInMilliseconds': 0
                                     }
                             }, 
                             'type': 'AudioPlayer.Play'
                    };
                })
            }
            var jsonresponse = {
                'outputSpeech': {
                     'text': '', 
                     'type': 'PlainText'
                    }, 
                'directives': [directives[0]]
            };     
            response.justUseThisJsonPlease( { response: jsonresponse } );
        });
    },


    "AudioPlayer.PlaybackNearlyFinished" : function(event, …
Run Code Online (Sandbox Code Playgroud)

alexa aws-lambda alexa-skills-kit

3
推荐指数
1
解决办法
1135
查看次数

标签 统计

alexa ×2

alexa-skills-kit ×2

aws-lambda ×2