对话框流程响应:Google上的操作

时间:2018-12-05 16:21:40

标签: dialogflow actions-on-google

我有一个带有BasicCard的简单响应的响应。从Dialogflow到Google助手的响应如下:

"payload": {
        "google": {
            "expectUserResponse": true,
            "richResponse": {
                "items": [
                    {
                        "simpleResponse": {
                            "textToSpeech": "Can you tell your TV's model number? (Eg. 42PFL7008S/12)",
                            "displayText": "Can you tell your TV's model number? (Eg. 42PFL7008S/12)"
                        },
                        "basicCard": {
                            "image": {
                                "url": "https://",
                                "accessibilityText": "The model number can be found here "
                            },
                            "title": "The model number can be found on here,
                            "subtitle": "It is also called Set-Type,"
                        }
                    }
                ],
                "suggestions": []
            }
        }
    }

在响应GA(模拟器)中,我收到以下错误:

expected_inputs[0].input_prompt.rich_initial_prompt: the first element must be a 'simple_response', a 'structured_response' or a 'custom_response'.

GA响应我在模拟器中看不到简单响应。.在某些地方丢弃了简单响应。.DialogFlow的此响应是否存在任何缺陷?

1 个答案:

答案 0 :(得分:0)

问题在于,items[]数组中的每个对象都应该具有单个字段,该字段指示项的类型。因此,一项将具有simpleResponse属性和相应的值。另一项将具有basicCard属性,并具有所有值。

您似乎在items[]数组中只有一个对象,它具有两个属性simpleResponsebasicCard。将它们分成数组中的两个对象。像这样:

                "items": [
                    {
                        "simpleResponse": {
                            "textToSpeech": "Can you tell your TV's model number? (Eg. 42PFL7008S/12)",
                            "displayText": "Can you tell your TV's model number? (Eg. 42PFL7008S/12)"
                        }
                    },
                    {
                        "basicCard": {
                            "image": {
                                "url": "https://",
                                "accessibilityText": "The model number can be found here "
                            },
                            "title": "The model number can be found on here,
                            "subtitle": "It is also called Set-Type,"
                        }
                    }
                ],