Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/jenkins/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 亚马逊Alexa是';t识别一个数字槽_Javascript_Amazon_Alexa - Fatal编程技术网

Javascript 亚马逊Alexa是';t识别一个数字槽

Javascript 亚马逊Alexa是';t识别一个数字槽,javascript,amazon,alexa,Javascript,Amazon,Alexa,假设我的模式中有这样一个: { "slots": [ { "name": "number", "type": "AMAZON.NUMBER" } ], "intent": "PriceMyProduct" } 这些话: PriceMyProduct price of {number} PriceMyProduct {number} price 在lambda函数中,我有一个意图处理程序 'PriceMyProduct': function

假设我的模式中有这样一个:

 {
  "slots": [
    {
      "name": "number",
      "type": "AMAZON.NUMBER"
    }
  ],
  "intent": "PriceMyProduct"
}
这些话:

PriceMyProduct price of {number}
PriceMyProduct {number} price
在lambda函数中,我有一个意图处理程序

'PriceMyProduct': function(){
        var itemNumber = this.event.request.slots.number.value;
         //DO STUFF
 }
问题是“itemNumber”永远不会提取产品的编号,因此它总是未定义的


我试过做“133202的价格”或“133923的价格”之类的事情,但数字值从未被提取出来。有什么问题吗?

尝试将插槽名称从“number”改为“priceValue”。大概是这样的:

{
  "slots": [
    {
      "name": "priceValue",
      "type": "AMAZON.NUMBER"
    }
  ],
  "intent": "PriceMyProduct"
}
PriceMyProduct price of {priceValue}
PriceMyProduct {priceValue} price
然后更新如下语句:

{
  "slots": [
    {
      "name": "priceValue",
      "type": "AMAZON.NUMBER"
    }
  ],
  "intent": "PriceMyProduct"
}
PriceMyProduct price of {priceValue}
PriceMyProduct {priceValue} price
在lambda中使用新名称:

'PriceMyProduct': function(){
    var itemNumber = this.event.request.slots.priceValue.value;
     //DO STUFF
 }

原因:这个号码似乎是个保留的名字

很抱歉这么晚才回来。你是对的。这起作用了。非常感谢你!