获取Google智能助理操作以响应“退出”或“取消”

时间:2017-10-29 22:47:05

标签: actions-on-google dialogflow

我试图关注documentation about App Exit handling,但似乎没有正常工作。 (见下面我意图的屏幕截图)。

当我这样做时,它似乎诉诸于我的默认回退意图,虽然它确实表明resolvedQueryactions_intent_CANCEL,这应该是正确的。 (参见下面的JSON主体。)

我做错了什么,或者说文档错了?

意图试图处理它:

enter image description here

JSON正文:


{
    "originalRequest": {
        "source": "google",
        "version": "2",
        "data": {
            "isInSandbox": true,
            "surface": {
                "capabilities": [
                    {
                        "name": "actions.capability.AUDIO_OUTPUT"
                    },
                    {
                        "name": "actions.capability.SCREEN_OUTPUT"
                    }
                ]
            },
            "inputs": [
                {
                    "rawInputs": [
                        {}
                    ],
                    "intent": "actions.intent.CANCEL"
                }
            ],
            "user": {
                "locale": "en-US",
                "userId": "AETml1QP6omTPEXBfrOBdvNlwHxY"
            },
            "conversation": {
                "conversationId": "1509314271837",
                "type": "ACTIVE",
                "conversationToken": "[]"
            },
            "availableSurfaces": [
                {
                    "capabilities": [
                        {
                            "name": "actions.capability.AUDIO_OUTPUT"
                        },
                        {
                            "name": "actions.capability.SCREEN_OUTPUT"
                        }
                    ]
                }
            ]
        }
    },
    "id": "bbd363aa-f555-4543-a748-294751194fa9",
    "timestamp": "2017-10-29T21:58:00.691Z",
    "lang": "en-us",
    "result": {
        "source": "agent",
        "resolvedQuery": "actions_intent_CANCEL",
        "speech": "",
        "action": "input.unknown",
        "actionIncomplete": false,
        "parameters": {},
        "contexts": [
            {
                "name": "actions_intent_cancel",
                "parameters": {},
                "lifespan": 0
            },
            {
                "name": "actions_capability_screen_output",
                "parameters": {},
                "lifespan": 0
            },
            {
                "name": "actions_capability_audio_output",
                "parameters": {},
                "lifespan": 0
            }
        ],
        "metadata": {
            "intentId": "25f6e14b-a92c-479b-8943-76c4b6914579",
            "webhookUsed": "true",
            "webhookForSlotFillingUsed": "false",
            "nluResponseTime": 2,
            "intentName": "Default Fallback Intent"
        },
        "fulfillment": {
            "speech": "I'm sorry. I didn't quite grasp what you just said.",
            "messages": [
                {
                    "type": 0,
                    "id": "535c3b80-f13d-4b61-8c1d-bb58fa3f5e44",
                    "speech": "I'm a bit confused by that last part."
                }
            ]
        },
        "score": 1
    },
    "status": {
        "code": 200,
        "errorType": "success"
    },
    "sessionId": "1509314271837"
}

2 个答案:

答案 0 :(得分:2)

documentation中的步骤外,我发现我必须告诉模拟器更新到最新版本!

这是我的视频,概述了我采取的步骤。 https://www.youtube.com/watch?v=ZvZDokjhUIY

enter image description here

enter image description here

答案 1 :(得分:1)

虽然这不是文档所暗示的,但我发现了一个似乎正确的解决方法。

由于似乎没有注册任何语音输入,看起来它对于后备意图是有意义的。由于除了默认值之外的后备意图需要一个上下文,而不仅仅是一个事件,并且看起来创建了actions_intent_cancel上下文,所以使用它似乎是合理的。

对此的后备意图可能如下所示:

enter image description here