【问题标题】:DialogFlow Google Assistant Webhook Response: "Empty speech response"DialogFlow Google Assistant Webhook 响应:“空语音响应”
【发布时间】:2018-02-28 13:49:23
【问题描述】:

我在使用 Dialogflow 的 Fulfillment/Webhook 时遇到了一些问题。我创建了一个 Intent,它接受一个参数作为输入(引脚号)。该 pin 在服务器端使用 Webhook 调用“验证”。即,选中“为此意图启用 webhook 调用”。该方法在验证成功时返回肯定消息。

只要我使用 Dialogflow 控制台的“立即尝试”窗口,整个场景就可以完美运行。但是当我尝试在 Google Assistant Simulator 中对其进行测试时,它会响应:

Screen from Actions on Google page > Response

还有,

Screen from Actions on Google page > Validation Errors

这是意图:

Intent screen from DialogFlow Agent page

我设置为从 Webhook 调用返回的响应:

"messages": [
  {
    "speech": "Thanks. Your pin has been confirmed.",
    "type": 0
  }

在此处找到示例响应:https://dialogflow.com/docs/fulfillment

请注意,我已经检查过Error "Empty speech response"。它没有帮助。

【问题讨论】:

    标签: json model-view-controller actions-on-google dialogflow-es


    【解决方案1】:

    这是一个很好的问题,文档中关于有效响应的内容看起来有点不清楚。

    在回复 Google 助理的消息时,您应该使用 speechdisplayText 参数进行回复。所以等效的响应将类似于

    {
      "speech": "Thanks. Your pin has been confirmed.",
      "displayText": "Thank you. We have confirmed your PIN and you can proceed."
    }
    

    但是,如果您要使用 Actions on Google 功能(卡片、功能请求等)进行其他工作,甚至只是在与用户交谈时保持对话畅通,那么您将需要使用 @987654326 @ 对象也可能包含simpleResponse 作为reply 的一部分。这可能看起来像这样:

    {
      "speech": "Thanks. Your pin has been confirmed.",
      "displayText": "Thank you. We have confirmed your PIN and you can proceed.",
      "data": {
        "google": {
          "expectUserResponse": true,
          "richResponse": {
            "items": [
              {
                "simpleResponse": {
                  "textToSpeech": "Thanks. Your pin has been confirmed.",
                  "displayText": "Thank you. We have confirmed your PIN and you can proceed."
                }
              }
            ]
          }
        }
      }
    }
    

    【讨论】:

    • 完美。有效。我很惊讶这些细节不在他们的官方文档中。为了我的目的,我可能仍然需要调整并在响应上做一些工作。我试图编辑您的回复,因为在 data.google 对象之前的 json 响应中缺少逗号,但编辑的长度至少需要 6 个字符。
    • 仅供参考,Google 已更新其帮助页面并包含详细信息:dialogflow.com/docs/fulfillment
    猜你喜欢
    • 2019-04-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-27
    • 2018-08-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多