【问题标题】:Wrong aspect ratio picture in Basic Card (Google Action)基本卡中的错误纵横比图片(Google 操作)
【发布时间】:2020-07-15 18:54:58
【问题描述】:

我已经设置了我的第一个 Google Action(基本),当我测试它时 (console.actions.google.com),基本卡片中的图片会以其原始比例显示。当我部署在 Dialogflow 中制作的代理时,图片因宽高比错误而失真。太小。不管原图是什么比例,都变成了2:3(w:h)。

Example Android One, Nokia 2.2

Screenshot-1 Screenshot-2

【问题讨论】:

  • 欢迎来到 StackOverflow!如果没有更多信息,很难回答您的问题。如果您可以更新您的问题以显示说明问题的示例代码,可能还有一些示例图片,我们可能会更好地为您提供帮助。见How do I ask a good question?
  • 我不使用代码。我是这方面的初学者。仅使用 Dialogflow 的基础知识。
  • 您能否展示一下您如何在 Dialogflow 中进行配置的屏幕截图?
  • 查看 2 张截图

标签: dialogflow-es actions-on-google aspect-ratio


【解决方案1】:

很遗憾,仅使用对话流无法解决此问题。要解决此问题,您应该通过履行来构建卡响应。属性'display' : 'CROPPED'。负责调整图像大小。您可以为此使用内联编辑器。我添加了一个可在内联编辑器中使用的代码示例。

有关更多信息,请查看 Google 的文档:https://developers.google.com/assistant/conversational/df-asdk/rich-responses#BasicCardSamples

function cardFunction(agent) {
  let conv = agent.conv();
  
  conv.ask(new BasicCard({
    text: `This is a basic card.  Text in a basic card can include "quotes" and
    most other unicode characters including emojis.  Basic cards also support
    some markdown formatting like *emphasis* or _italics_, **strong** or
    __bold__, and ***bold itallic*** or ___strong emphasis___ as well as other
    things like line  \nbreaks`, // Note the two spaces before '\n' required for
                                 // a line break to be rendered in the card.
    subtitle: 'This is a subtitle',
    title: 'Title: this is a title',
    buttons: new Button({
      title: 'This is a button',
      url: 'https://assistant.google.com/',
    }),
    image: new Image({
      url: 'https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png',
      alt: 'Image alternate text',
    }),
    display: 'CROPPED',
  }));

  agent.add(conv)
}

【讨论】:

  • 好的,谢谢,奇怪的是这是默认设置。(?)。
猜你喜欢
  • 1970-01-01
  • 2017-11-21
  • 1970-01-01
  • 2019-04-03
  • 1970-01-01
  • 2014-11-19
  • 1970-01-01
  • 2022-08-24
  • 1970-01-01
相关资源
最近更新 更多