如何呈现从Webhook返回的列表

问题描述

我正在使用Google Actions。我从Webhook返回JSON,并在模拟器中测试动作时收到以下错误:

“由于缺少插槽的类型覆盖而无法呈现列表或集合提示。请注意,列表和集合仅应在插槽填充中使用。应该有一个相应的类型替代,用于描述如何呈现列表或集合。这种类型。”

JSON是从https://developers.google.com/assistant/conversational/prompts-selection的文档中获取的经过稍微修改的示例。

typeOverrides名称“ items”与场景的插槽名称匹配。

这是webhook请求和响应JSON。

***请求***

 {
  "handler": {
    "name": "aa"
  },"intent": {
    "name": "searchIntent","params": {
      "searchParm": {
        "original": "milk","resolved": "milk"
      }
    },"query": "milk"
  },"scene": {
    "name": "Start","slotFillingStatus": "UNSPECIFIED","slots": {},"next": {
      "name": "SearchScene"
    }
  },"session": {
    "id": "ABwppHGln0UTzfUPqJ1SMr1Cuw2TyPjJQoGUkULazcObus3vUwJCJCpba--5PSRwjqMQelRqMAUnwPvl","params": {},"typeOverrides": [],"languageCode": ""
  },"user": {
    "locale": "en-AU","accountLinkingStatus": "ACCOUNT_LINKING_STATUS_UNSPECIFIED","verificationStatus": "VERIFIED","packageEntitlements": [],"lastSeenTime": "2020-11-05T21:24:16Z"
  },"home": {
    "params": {}
  },"device": {
    "capabilities": [
      "SPEECH","RICH_RESPONSE","LONG_FORM_AUDIO"
    ]
  }
}

***响应***

{
  "session": {
    "id": "ABwppHGln0UTzfUPqJ1SMr1Cuw2TyPjJQoGUkULazcObus3vUwJCJCpba--5PSRwjqMQelRqMAUnwPvl","typeOverrides": [
      {
        "name": "items","synonym": {
          "entries": [
            {
              "name": "ITEM_1","synonyms": [
                "Item 1","First item"
              ],"display": {
                "title": "Item #1","description": "Description of Item #1","image": {
                  "alt": "Google Assistant logo","height": 0,"url": "https://developers.google.com/assistant/assistant_96.png","width": 0
                }
              }
            },{
              "name": "ITEM_2","synonyms": [
                "Item 2","Second item"
              ],"display": {
                "title": "Item #2","description": "Description of Item #2",{
              "name": "ITEM_3","synonyms": [
                "Item 3","Third item"
              ],"display": {
                "title": "Item #3","description": "Description of Item #3",{
              "name": "ITEM_4","synonyms": [
                "Item 4","Fourth item"
              ],"display": {
                "title": "Item #4","description": "Description of Item #4","width": 0
                }
              }
            }
          ]
        },"typeOverrideMode": "TYPE_REPLACE"
      }
    ]
  },"prompt": {
    "override": false,"content": {
      "list": {
        "items": [
          {
            "key": "ITEM_1"
          },{
            "key": "ITEM_2"
          },{
            "key": "ITEM_3"
          },{
            "key": "ITEM_4"
          }
        ],"subtitle": "List subtitle","title": "List title"
      }
    },"firstSimple": {
      "speech": "This is a list.","text": "This is a list."
    }
  }
}

Slot Details

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)