在单一响应中无法在 Alexa 上显示多个主页卡显示

Having trouble displaying Multiple Home Card Display on Alexa in Single Response

我在 ALEXA (Amazon Echo) 上有一个应用程序 运行。我正在实施带有图像的主页卡片显示。如果响应只有一张卡片,则何时进行特定调用。它显示非常好。附上截图

"Response": {
  "version" : "1.0",
  "sessionAttributes": {
    "UserCityId": "1",
    "UserCity": "London",
    "latitude": "51.50735090",
    "longitude": "-0.12775830",
    "categoryID": "900",
    "company_id": "1154916",
    "first_name": "User FName",
    "yes_no_for": "",
    "cat_start_limit": "0",
    "categoryName": "music",
    "total_cat_events": "2178",
    "show_rec": "5"
  },
  "response": {
    "outputSpeech": {
      "type": "PlainText",
      "text": "This is what alexa speaks out"
    },
    "card": {
      "type": "Standard",
      "title": "Music events in London",
      "text": "The speech passed to alexa",
      "image": { 
        "smallImageUrl": "https:\/\/xyz.com\/version\/sports-car-1374425_960_720.jpg",
        "largeImageUrl": "https:\/\/xyz.com\/version\/sports-car-1374425_960_720.jpg"
      }
     },
    "reprompt": {
      "outputSpeech": {
        "type": "PlainText",
        "text": "Would you like to know events for music ,sports, or something else. Please select one category"
      }
    },
     "shouldEndSession": false
  }
}

以上代码有效

问题如下: 但是,如果相同的响应有卡片数组(多张卡片),则 alexa 无法给出错误。

"Response": {
  "version": "1.0",
  "sessionAttributes": {
    "UserCityId": "1",
    "UserCity": "London",
    "latitude": "51.50735090",
    "longitude": "-0.12775830",
    "categoryID": "900",
    "customer_id": "1154916",
    "first_name": "UserFNAME",
    "yes_no_for": "",
    "cat_start_limit": "0",
    "categoryName": "music",
    "total_cat_events": "2178",
    "show_rec": "5"
  },
  "response" : {
    "outputSpeech" : {
      "type": "PlainText",
      "text": "5th. Baba Yaga's Hut Presents Jambinai, at Corsica Studios, on Monday, May 16th , 7 30 pm"
    },                
    "card": [{
      "type": "Standard",
      "title": "Music events in London",
      "text": "1. Dove Jones Blues Jam!, at Phoenix Artist Club, on Monday, May 16th , 7pm",
      "image": {
        "smallImageUrl": "https:\/\/xyz.com\/version\/sports-car-1374425_960_720.jpg",
        "largeImageUrl": "https:\/\/xyz.com\/version\/sports-car-1374425_960_720.jpg"
      }
    }, {
      "type": "Standard",
      "title": "Music events in London",
      "text": "2. The Hillbilly Moon Explosion, at The Borderline, on Monday, May 16th, 7pm",
      "image": {
        "smallImageUrl": "https:\/\/xyz.com\/version\/sports-car-1374425_960_720.jpg",
        "largeImageUrl": "https:\/\/xyz.com\/version\/sports-car-1374425_960_720.jpg"
      }
    }, {
      "type": "Standard",
      "title": "Music events in London",
      "text": "3. Sian Evans Of Kosheen, at 100 Club, on Monday, May 16th , 7 30 pm",
      "image": {
        "smallImageUrl": "https:\/\/xyz.com\/version\/sports-car-1374425_960_720.jpg",
        "largeImageUrl": "https:\/\/xyz.com\/version\/sports-car-1374425_960_720.jpg"
      }
    }, {
      "type": "Standard",
      "title": "Music events in London",
      "text": "4. Rinocerose, at The Water Rats, on Monday, May 16th , 7 30 pm",
      "image": {
        "smallImageUrl": "https:\/\/xyz.com\/version\/sports-car-1374425_960_720.jpg",
        "largeImageUrl": "https:\/\/xyz.com\/version\/sports-car-1374425_960_720.jpg"
      }
    }, {
      "type": "Standard",
      "title": "Music events in London",
      "text": "5. Baba Yaga's Hut Presents Jambinai, at Corsica Studios, on Monday, May 16th , 7 30 pm",
      "image": {
        "smallImageUrl": "https:\/\/xyz.com\/version\/sports-car-1374425_960_720.jpg",
        "largeImageUrl": "https:\/\/xyz.com\/version\/sports-car-1374425_960_720.jpg"
      }
    }],
    "reprompt": {
      "outputSpeech": {
        "type": "PlainText",
        "text": "Would you like to know events for music ,sports, or something else. Please select one category"
      }
    },
    "shouldEndSession" : false
  }
}

以上代码无效。

这是我要转换的东西:请看截图

对于 london call 中的事件,我在单张卡片中获得了 5 个事件的列表。我想为每个事件分配图像并创建其卡片。

任何人都可以帮助解决这个问题,并找出在 JSON 响应中使用多张卡片的问题。 难道alexa只支持单卡响应?

响应中的卡片属性采用对象而不是数组。

这是亚马逊在 site:

上使用的示例
{
  "version": "string",
  "sessionAttributes": {
    "string": object
  },
  "response": {
    "outputSpeech": {
      "type": "string",
      "text": "string",
      "ssml": "string"
    },
    "card": {
      "type": "string",
      "title": "string",
      "content": "string",
      "text": "string",
      "image": {
        "smallImageUrl": "string",
        "largeImageUrl": "string"
      }
    },
    "reprompt": {
      "outputSpeech": {
        "type": "string",
        "text": "string",
        "ssml": "string"
      }
    },
    "shouldEndSession": boolean
  }
}

如果您想尝试制作多张卡片,您可以尝试发送多个回复,但我不确定这是否可行。

我认为您最好的选择是针对您的问题考虑与用户进行不同的交互,然后出示多张卡片。