Google上的操作[权限意图]获取用户位置/姓名

时间:2018-05-14 14:13:44

标签: actions-on-google dialogflow

const agent = new WebhookClient({request, response});
const {WebhookClient} = require('dialogflow-fulfillment');
const {Text, Card, Image, Suggestion, Payload} = require('dialogflow-fulfillment');


let payload = {
          "systemIntent": {
            "intent": "actions.intent.PERMISSION",
            "data": {
              "@type": "type.googleapis.com/google.actions.v2.PermissionValueSpec",
              "optContext": "To deliver your order",
              "permissions": [
                "NAME",
                "DEVICE_PRECISE_LOCATION"
              ]
            }
          }
        };
agent.add('PLACEHOLDER_FOR_PERMISSION');
agent.add(new Payload(PLATFORMS.ACTIONS_ON_GOOGLE, payload));

使用允许意图获取UserLocation和Name的简单有效负载

对上面的反应我明白了

  

要发送您的订单,我需要获取您的姓名和街道地址   来自Google。那可以吗?

此意图的跟随意图也设置为事件 actions_intent_PERMISSION

我一直试图通过尝试使用建议芯片等解雇 actions_intent_PERMISSION 来解决这个问题,但此后没有任何反应?

我哪里出错了,我无法理解。在某个地方有一些愚蠢的错误 - 如果有人可以指出它 - 请帮助很多。

由于

===========编辑============为这些意图附着的图像============

permissions intent

permissions response with event actions_intent_PERMISSION

编辑:由于点数无法嵌入图像。以上链接在那里。感谢

================================= request-response json ========== ========= 当下面触发意图权限时,请求

{
  "responseId": "54a4be35-3d0b-4cc8-b036-46fab0d09361",
  "queryResult": {
    "queryText": "permissions",
    "action": "permissions",
    "parameters": {},
    "allRequiredParamsPresent": true,
    "fulfillmentMessages": [
      {
        "text": {
          "text": [
            ""
          ]
        }
      }
    ],
    "intent": {
      "name": "projects/projectid/agent/intents/95237653-0af0-4d0c-9101-0cd8ee0db186",
      "displayName": "permissions"
    },
    "intentDetectionConfidence": 1,
    "diagnosticInfo": {},
    "languageCode": "en"
  },
  "originalDetectIntentRequest": {
    "payload": {}
  },
  "session": "projects/projectid/agent/sessions/13213e7f-dba5-4d0c-979a-f626f7ac4691"
}

履行回应

{
  "conversationToken": "[]",
  "expectUserResponse": true,
  "expectedInputs": [
    {
      "inputPrompt": {},
      "possibleIntents": [
        {
          "intent": "actions.intent.PERMISSION",
          "inputValueData": {
            "@type": "type.googleapis.com/google.actions.v2.PermissionValueSpec",
            "permissions": [
              "NAME",
              "DEVICE_PRECISE_LOCATION"
            ],
            "optContext": "To locate you"
          }
        }
      ],
      "speechBiasingHints": [
        "$name-type",
        "$sports",
        "$gender"
      ]
    }
  ],
  "responseMetadata": {
    "status": {
      "message": "Success (200)"
    },
    "queryMatchInfo": {
      "queryMatched": true,
      "intent": "95237653-0af0-4d0c-9101-0cd8ee0db186"
    }
  }
}

模拟器对权限意图

的响应
  

=============================================== ========================

问题已经解决 注意事项:

  1. Google-on-Google模拟器上的操作非常奇怪,值得信赖 您的webhook是否正常工作
  2. 承诺解决方案是一个 问题 - 代理人正在等待在此之前解决的承诺 它被传递到下一次
  3. 正确测试机器人的方法 是在助手目录中将您的机器人发布在ALPHA中 而不是在模拟器上进行测试,因为它在术语上非常不稳定 你永远无法预测它的行为。永远不会告诉你 正确的调试错误,将突然停止工作 无论如何

0 个答案:

没有答案