将精确的位置传递给Dialogflow API V2请求

时间:2018-10-19 12:11:53

标签: dialogflow

我正在使用Dialogflow API v2通过HTTP请求测试我的意图(我正在使用Postman)。

POST https://dialogflow.googleapis.com/v2/projects/ {{projectId}} / agent / sessions / {{session}}:detectIntent

身体

{
  "queryInput": {
    "text": {
      "text":"{{query}}",
      "languageCode":"en"
    }
  },
  "queryParams": {
    "timeZone":"xxxxx",
    "geoLocation": {
      "latitude": 0,
      "longitude": 0
    },
  }
}

当我的意图要求精确的位置时(我的代码在下面):

conv.ask(new Permission({
  context: "Before I can answer you",
  permissions: "DEVICE_PRECISE_LOCATION"
}));

API响应为;

{
  "responseId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
  "queryResult": {
    "queryText": "Where is the nearest store?",
    "parameters": {
        "nearest": "nearest"
    },
    "allRequiredParamsPresent": true,
    "fulfillmentText": "Cannot display response in Dialogflow simulator. Please test on the Google Assistant simulator instead.",
    "fulfillmentMessages": [
        {
            "text": {
                "text": [
                    "Cannot display response in Dialogflow simulator. Please test on the Google Assistant simulator instead."
                ]
            }
        }
    ],
    "webhookPayload": {
        "google": {
            "systemIntent": {
                "intent": "actions.intent.PERMISSION",
                "data": {
                    "optContext": "Before I can answer you",
                    "permissions": [
                        "DEVICE_PRECISE_LOCATION"
                    ],
                    "@type": "type.googleapis.com/google.actions.v2.PermissionValueSpec"
                }
            },
            "richResponse": {
                "items": [
                    {
                        "simpleResponse": {
                            "textToSpeech": "PLACEHOLDER"
                        }
                    }
                ]
            },
            "expectUserResponse": true
        }
    },
    "intent": {
        "name": "projects/xxxx/agent/intents/xxxxx",
        "displayname": "Find store",
    },
...
}

是否可以在DialogFlow API v2请求上提供位置并跳过权限请求?我不仅要测试意图,还要测试基于位置的响应。

0 个答案:

没有答案