Why is the carousel not showing in the console simulator?

不问归期 提交于 2019-11-29 11:40:51

You haven't shot yourself in the foot - but you have made something that was already a bit complex even more complex. There are two things to look out for:

  1. CORRECTION: Make sure the payload is the same as what used to be data, but other fields have changed format.

  2. You need to make sure the simulator is in Phone mode and not Speaker mode.

Details follow.

Documented Dialogflow Differences

The Actions on Google documentation for the Dialogflow response is a little confusing. Instead of providing the full example, it just says that the response that would be under expectedInputs.possibleIntents should, instead, be under data.google.systemIntent. For V2, that would be payload.google.systemIntent.

The inputPrompt object is also restructured somewhat so you should be sending a richResponse that contains a simpleResponse object.

UPDATE I've tested this. This is the entire JSON that should be returned. Note the contents of payload is exactly what the contents of data used to be. The source field is ignored and has nothing to do with the payload, apparently.

See also https://github.com/dialogflow/fulfillment-webhook-json which contain some examples.

{
    "payload": {
        "google": {
            "expectUserResponse": true,
            "richResponse": {
                "items": [
                    {
                        "simpleResponse": {
                            "textToSpeech": "This is a carousel"
                        }
                    }
                ]
            },
            "systemIntent": {
                "intent": "actions.intent.OPTION",
                "data": {
                    "@type": "type.googleapis.com/google.actions.v2.OptionValueSpec",
                    "carouselSelect": {
                        "items": [
                            {
                                "optionInfo": {
                                    "key": "key1",
                                    "synonyms": [
                                        "Option 1"
                                    ]
                                },
                                "title": "Option 1",
                                "description": "Option 2"
                            },
                            {
                                "optionInfo": {
                                    "key": "key2",
                                    "synonyms": [
                                        "Option 2"
                                    ]
                                },
                                "title": "Option 2",
                                "description": "Option 2"
                            }
                        ]
                    }
                }
            }
        }
    }
}

Simulator Surface Setting

Make sure that your simulator is set for the "Phone" surface rather than the "Speaker" surface. Options won't display on a Speaker.

The setting should look like this:

Not like this:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!