简体   繁体   English

基本卡不会显示在Google动作模拟器控制台中,也不会显示在使用Google助手的iPhone上

[英]Basic Card is not displayed in the Google action simulator console, and also not on my iPhone using google assistant

Basic Card is not displayed in the Google action simulator console, and also not on my iPhone using Google Assistant 基本卡不会显示在Google动作模拟器控制台中,也不会显示在使用Google智能助理的iPhone上

Here is the JSON code I send : 这是我发送的JSON代码:

{
    "expectUserResponse": true,
    "expectedInputs": [
        {
            "possibleIntents": [
                {
                    "intent": "actions.intent.TEXT"
                }
            ],
            "inputPrompt": {
                "richInitialPrompt": {
                    "items": [
                        {
                            "simpleResponse": {
                                "textToSpeech": "This is a basic card example."
                            }
                        },
                        {
                            "basicCard": {
                                "title": "Title: this is a title",
                                "subtitle": "This is a subtitle",
                                "formattedText": "This is a basic card.  Text in a basic card can include \"quotes\" and\n        most other unicode characters including emoji 📱.  Basic cards also support\n        some markdown formatting like *emphasis* or _italics_, **strong** or\n        __bold__, and ***bold itallic*** or ___strong emphasis___ as well as other\n        things like line  \nbreaks",
                                "image": {
                                    "url": "https://example.com/image.png",
                                    "accessibilityText": "Image alternate text"
                                },
                                "buttons": [
                                    {
                                        "title": "This is a button",
                                        "openUrlAction": {
                                            "url": "https://assistant.google.com/"
                                        }
                                    }
                                ],
                                "imageDisplayOptions": "CROPPED"
                            }
                        }
                    ]
                }
            }
        }
    ]
}

and here is what I get in the simulator and on the iPhone using Google assistant : [object Object] 以下是我使用Google助手在模拟器和iPhone上获得的内容: [object Object]

The debug in the simulator returns : 模拟器中的调试返回:

{
  "response": "[object Object]",
  "expectUserResponse": true,
  "conversationToken": "EroCS2w1Tm...",
  "audioResponse": "//NExAAAAA...",
  "ssmlMarkList": [],
  "debugInfo": {
    "assistantToAgentDebug": {
      "curlCommand": "curl -v https://88.176.64.72:8081/ -H 'Content-Type: application/json;charset=UTF-8' -H 'Google-Actions-API-Version: 2' -H 'Authorization: eyJhbGciOiJSUzI1NiIsImtpZCI6IjM3ODJkM2YwYmM4OTAwOGQ5ZDJjMDE3MzBmNzY1Y2ZiMTlkM2I3MGUiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLCJhdWQiOiJteS10ZXN0LWFwcC1kMTNkZSIsIm5iZiI6MTU1NTI3NTE2OCwiaWF0IjoxNTU1Mjc1NDY4LCJleHAiOjE1NTUyNzU1ODgsImp0aSI6IjVhZWM0ZjAwNzJiNmNjMTcyMDlmZTdiMmJlZDhjZDRlZTI4ZjExYTIifQ.P-SnzkjiWcr-GubTRdT_juTUVAPBn9J6spSRHPqykwsBq3AppsHg2GNBzlDfwhAXbxZAogW-Mdr4k_U2E1cQMGu-fdGnrkkg4UmjGvYz8za5SGaN-OVx3TNYsoayGIgTFn01gmZOIZfI_33-OucZtFSQCHo82YEmK6ypz3kBq5_vGAjdu01cgYEHAXdT6c53LGSEoewhK4F2M-KphlSx3eFYj2yLWJFn7w9w-Yf3W1n5Rm9q9ZGFJ4vNKIZlX0_J-T-6HhB84OX6k9qJYZ8_1FXp6CS9bPOAo_Nid9k1OeONDIJcCwp1GnQTQB4dek77xybmUn5Qo4-ad1IOzHOkNA'  -A 'Mozilla/5.0 (compatible; Google-Cloud-Functions/2.1; +http://www.google.com/bot.html)' -X POST -d '{\"user\":{\"userId\":\"ABwppHGZMM6CHA-JcPkrCzVpkgGv953hFvVdAGAEGOWQSETGxFO18zXyIbXrhHAlw63M9Gz7dKcFxn3fIGKd2sw\",\"locale\":\"fr-CA\",\"lastSeen\":\"2019-04-14T20:53:31Z\",\"userStorage\":\"{\\\"data\\\":{}}\"},\"conversation\":{\"conversationId\":\"ABwppHEJaVmbTFuCLu0rK3SBxm_bviFYhyoY6oIa8o3MNqI2gHalTVPumj9cetdIsmtbVlfU-vNhIxBGsYRmWvs\",\"type\":\"ACTIVE\",\"conversationToken\":\"{}\"},\"inputs\":[{\"intent\":\"actions.intent.TEXT\",\"rawInputs\":[{\"inputType\":\"KEYBOARD\",\"query\":\"image\"}],\"arguments\":[{\"name\":\"text\",\"rawText\":\"image\",\"textValue\":\"image\"}]}],\"surface\":{\"capabilities\":[{\"name\":\"actions.capability.MEDIA_RESPONSE_AUDIO\"},{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.WEB_BROWSER\"},{\"name\":\"actions.capability.SCREEN_OUTPUT\"},{\"name\":\"actions.capability.ACCOUNT_LINKING\"}]},\"isInSandbox\":true,\"availableSurfaces\":[{\"capabilities\":[{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.SCREEN_OUTPUT\"},{\"name\":\"actions.capability.WEB_BROWSER\"}]}],\"requestType\":\"SIMULATOR\"}'",
      "assistantToAgentJson": "{\"user\":{\"userId\":\"ABwppHGZMM6CHA-JcPkrCzVpkgGv953hFvVdAGAEGOWQSETGxFO18zXyIbXrhHAlw63M9Gz7dKcFxn3fIGKd2sw\",\"locale\":\"fr-CA\",\"lastSeen\":\"2019-04-14T20:53:31Z\",\"userStorage\":\"{\\\"data\\\":{}}\"},\"conversation\":{\"conversationId\":\"ABwppHEJaVmbTFuCLu0rK3SBxm_bviFYhyoY6oIa8o3MNqI2gHalTVPumj9cetdIsmtbVlfU-vNhIxBGsYRmWvs\",\"type\":\"ACTIVE\",\"conversationToken\":\"{}\"},\"inputs\":[{\"intent\":\"actions.intent.TEXT\",\"rawInputs\":[{\"inputType\":\"KEYBOARD\",\"query\":\"image\"}],\"arguments\":[{\"name\":\"text\",\"rawText\":\"image\",\"textValue\":\"image\"}]}],\"surface\":{\"capabilities\":[{\"name\":\"actions.capability.MEDIA_RESPONSE_AUDIO\"},{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.WEB_BROWSER\"},{\"name\":\"actions.capability.SCREEN_OUTPUT\"},{\"name\":\"actions.capability.ACCOUNT_LINKING\"}]},\"isInSandbox\":true,\"availableSurfaces\":[{\"capabilities\":[{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.SCREEN_OUTPUT\"},{\"name\":\"actions.capability.WEB_BROWSER\"}]}],\"requestType\":\"SIMULATOR\"}",
      "delegatedRequest": {
        "delegatedRequest": ""
      }
    },
    "agentToAssistantDebug": {
      "agentToAssistantJson": "{\"conversationToken\":\"{}\",\"expectUserResponse\":true,\"expectedInputs\":[{\"inputPrompt\":{\"initialPrompts\":[{\"textToSpeech\":\"[object Object]\"}],\"noInputPrompts\":[]},\"possibleIntents\":[{\"intent\":\"actions.intent.TEXT\"}]}]}",
      "delegatedResponse": {
        "delegatedResponse": ""
      }
    },
    "sharedDebugInfoList": []
  },
  "visualResponse": {
    "visualElementsList": [
      {
        "displayText": {
          "content": "[object Object]"
        }
      }
    ],
    "suggestionsList": [],
    "agentLogoUrl": "https://www.gstatic.com/voice/opa/partner_icons/generic_3p_avatar.png",
    "agentStyle": {
      "primaryColor": "",
      "fontFamily": "",
      "borderRadius": 0,
      "backgroundColor": "",
      "backgroundImageUrl": ""
    }
  },
  "clientError": 0,
  "is3pResponse": true,
  "clientOperationList": [
    {
      "operationType": 1,
      "micUpdatePayLoad": {
        "micMode": 1
      }
    }
  ],
  "projectName": ""
}

Why am I not getting the correct results? 为什么我没有得到正确的结果?

I use Node-Red and the google-action-contrib to make the link beetween ation-on-google and my machine. 我使用Node-Red和google-action-contrib来在gotion-on-google和我的机器之间建立链接。 Everything works fine, I can create a dialog, receive and send sentences... Now, I would like to send a BasicCard (because it seems hat is the correct way to send an image, and many other things, like a button, etc...) 一切正常,我可以创建一个对话框,接收和发送句子......现在,我想发送一个BasicCard(因为看起来帽子是发送图像的正确方式,以及许多其他的东西,如按钮等...)

I have put as many datas as possble in this forum, with attached files (wireshark capture, debug information, code): https://discourse.nodered.org/t/google-action-response-with-an-image-basic-card/10145/7 我已经在这个论坛中放置了尽可能多的数据,附带文件(wireshark捕获,调试信息,代码): https ://discourse.nodered.org/t/google-action-response-with-an-image-basic -card /七分之一万○一百四十五

Thanks for your help 谢谢你的帮助

It looks like you're not actually sending the JSON as JSON, but rather you've built an object, and are sending the toString version of it. 看起来你实际上并没有将JSON作为JSON发送,而是你已经构建了一个对象,并且正在发送它的toString版本。 This is suggested by the part of the response logged that says 记录的响应部分表明了这一点

"response": "[object Object]"

Without seeing the code you are using to send the response, it is pretty difficult to help further. 如果没有看到用于发送响应的代码,则很难进一步提供帮助。

I assume you've used the sample code in your action. 我假设您已在行动中使用了示例代码。 However, unless you changed the url fields, your action can not find the imageUrl and openUrlAction. 但是,除非您更改了url字段,否则您的操作无法找到imageUrl和openUrlAction。

If you change url fields with actual(not " http://example.com ") links, your app will respond properly. 如果您使用实际(而非“ http://example.com ”)链接更改网址字段,您的应用将会正确回复。

Also make sure you've added necessary classes. 还要确保你已经添加了必要的课程。

eg 例如

const { dialogflow, BasicCard, Image, Button } = require('actions-on-google');

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

相关问题 浏览轮播卡不适用于 Dialogflow 中的谷歌助手 - Browse Carousel Card not working for google assistant in Dialogflow 使用DialogFlow隐式调用Google Assistant Action App - Implicit Invocation of Google Assistant Action App with DialogFlow not working 为什么即使在使用PHP删除它们之后,HTML实体也会在iPhone / iPhone模拟器上显示? - Why the HTML entities are getting displayed on iPhone/iPhone simulator even after removing them using PHP? Google Assistant SDK中的多个参数 - Multiple parameters in Google Assistant SDK Google Assistant SDK中的多个命令 - Multiple commands in Google Assistant SDK Google Assistant SDK [自定义类型]:通过自定义操作捕获货币值($ 10,$ 20。$ 50) - Google assistant sdk [CUSTOM TYPES ]: capture monetary values ($10, $20. $50) from a custom action 标记未使用JSON显示在Google地图中 - Markers not displayed in the google map using JSON 在Dialogflow上没有错误时,Google智能助理出错 - Error on Google Assistant while no error on Dialogflow 在 Linux 上使用 gaction 更新 Google Home/Assistant 包时,Golang 运行时会出现恐慌? - Golang runtime panic when using gaction on Linux to update Google Home/Assistant package? 如何从Google Developer's Console检索我的安装统计信息 - How to retrieve my Install Statistics from the Google Developer's Console
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM