简体   繁体   English

用于MediaObject的Dialogflow API V2 largeImage无法正常工作

[英]Dialogflow API V2 largeImage for MediaObject not working

I recently switched from the V1 to V2 for dialogflow and I'm updating my webhook. 我最近从V1切换到V2进行对话,并且正在更新我的Webhook。

I use mediaObjects with large Images in my agent as a personal taste. 我将代理中带有大图像的mediaObjects用作个人喜好。 Unfortunately I can't seem to make it work for the V2. 不幸的是,我似乎无法使其适用于V2。 My current code for the media object is this: 我当前的媒体对象代码是:

 conv.ask(new MediaObject({
          name: 'Name',
          largeImage: new Image({
              url: 'https://[...].jpg',
              alt: 'alternative'
          }),
          url: 'https://[...].mp3',
          description: 'description'
}));

As you can see, I used the largeImage field, as I found it in the JSON section of Google's example . 如您所见,我使用了largeImage字段,该字段是在Google的 JSON部分中找到 As the documentation is inexistant, I'm checking the node.js library for information and I verified that the largeImage field extends the Image interface so it should be correct. 由于文档不存在,因此我正在检查node.js库以获取信息,并且验证了largeImage字段扩展了Image接口,因此它应该正确。

It works when I switch largeImage for Icon but I don't like it. 当我将largeImage切换为Icon时,它可以工作,但我不喜欢它。

My JSON response is like this: 我的JSON响应是这样的:

"payload": {
    "google": {
      "expectUserResponse": true,
      "richResponse": {
        "items": [
          {
            "simpleResponse": {
              "textToSpeech": "text"
            }
          },
          {
            "mediaResponse": {
              "mediaType": "AUDIO",
              "mediaObjects": [
                {
                  "contentUrl": "https://[...].mp3",
                  "description": "description",
                  "name": "name"
                }
              ]
            }
          }
        ],
        "suggestions": [
          {
            "title": "Not yet implemented"
          }
        ]
      },
      "userStorage": "{\"data\":{}}"
    }
  }

For some reason the largeImage field doesn't appear in my JSON but there isn't any error appearing anywhere. 由于某种原因,largeImage字段没有出现在我的JSON中,但是任何地方都没有出现任何错误。

Some of the APIs in JSON do not match the Node.js parameters. JSON中的某些API与Node.js参数不匹配。 For example, largeImage in JSON is actually image in the MediaObjectOptions definition. 例如, largeImage在JSON实际上是imageMediaObjectOptions定义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM