如何在Google的动作中显示多个构造函数组合

问题描述

我想通过使用多个构造器来组成一个屏幕 在对Google代码(而不是dialogflow代码)的操作中。

但是它不起作用。有什么办法吗?

const {
  conversation,Simple,Card,Image,Button,List,Table,CollectionBrowse,// LinkOutSuggestion,--------------------->[LinkOutSuggestion is not constructor ERROR]
  Schema
}  = require('@assistant/conversation');
const functions = require('firebase-functions');
const app = conversation({debug:true});

app.handle('callApi',(conv) => {
  
  conv.add(new CollectionBrowse({
    items:
      [
        {
          title: 'Item #1',description: 'Description of Item #1',footer: 'Footer of Item #1',image: {
            url: 'https://developers.google.com/assistant/assistant_96.png',},openUriAction: {
            url: 'https://www.example.com',{
          title: 'Item #2',description: 'Description of Item #2',footer: 'Footer of Item #2',],}));
  
     conv.add(new Card({
          title: "hello1",subtitle:  "hi",text: "blablablablablablablablablablablablablablablablablabla",image: new Image({
              url: "some url",alt: "Some alternative text",})
        }));
  
    // conv.add(new LinkOutSuggestion({ 
    // name: 'Suggestion Link',// url: 'https://assistant.google.com/',}));
});

exports.ActionsOnGoogleFulfillment = functions.https.onRequest(app);

错误消息

webhookResponse

来自Webhook的无效响应:无法将JSON转换为ExecuteHttpResponse。.

{
  "responseJson": {
    "session": {
      "id": "ABwppHHmGWHUrN7IC93YqazqN36yfOYZbgBKkG8RHvwv7H4WkHVZDJGfKn3HYNBKGb6imB3TJJpRhqwJ_L8","params": {},"languageCode": ""
    },"prompt": {
      "override": false,"content": {
        "card": {
          "title": "hello1","subtitle": "hi","text": "blablablablablablablablablablablablablablablablablabla","image": {
            "alt": "Some alternative text","height": 0,"url": "some url","width": 0
          }
        },"collectionBrowse": {
          "imageFill": "UNSPECIFIED","items": [
            {
              "title": "Item #1","description": "Description of Item #1","footer": "Footer of Item #1","image": {
                "url": "https://developers.google.com/assistant/assistant_96.png"
              },"openUriAction": {
                "url": "https://www.example.com"
              }
            },{
              "title": "Item #2","description": "Description of Item #2","footer": "Footer of Item #2","openUriAction": {
                "url": "https://www.example.com"
              }
            }
          ]
        }
      }
    }
  }
}

,我想在@ assistant / conversation中找到LinkOutSuggestion函数。

解决方法

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

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

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