首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >基本卡中的错误长宽比图片(Google Action)

基本卡中的错误长宽比图片(Google Action)
EN

Stack Overflow用户
提问于 2020-07-14 19:56:22
回答 1查看 199关注 0票数 0

我已经设置了我的第一个Google Action ( basic ),当我测试它(console.actions.google.com)时,基本卡中的图片会以它们的原始比例显示。当我部署在Dialogflow中制作的代理时,图片被扭曲成错误的纵横比。太小了。无论原始图片的比例是什么,它们都被更改为2:3 (w:h)。

Example Android One, Nokia 2.2

Screenshot-1 Screenshot-2

EN

Stack Overflow用户

发布于 2020-07-15 18:54:58

不幸的是,这个问题不能单独使用dialogflow来解决。要解决此问题,您应该通过实现来构建卡片响应。属性'display' : 'CROPPED'。负责调整图像的大小。您可以使用内联编辑器来执行此操作。我已经添加了一个可以在内联编辑器中使用的代码示例。

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

代码语言:javascript
运行
复制
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)
}
票数 0
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62894627

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档