【问题标题】:Google Action fulfillment not working in simulatorGoogle Action 实现在模拟器中不起作用
【发布时间】:2023-04-03 15:20:01
【问题描述】:

我在 Dialogflow 中使用 webhook 设置了一个操作,该操作使用 ngrok 隧道指向本地服务器。当使用 Dialogflow 的“立即测试”功能时,webhook 正在工作,请求被发送到 webhook 并正在接收响应,但是在模拟器中测试时它显示“操作现在没有响应”。在 ngrok 日志中,我可以看到向端点发出的请求与使用“立即测试”时相同。 在模拟器的日志中显示“MalformedResponse:无法将 Dialogflow 响应解析为 AppResponse”。

这是从 Dialogflow 的诊断信息中看到的履行响应:

{
  "payload": {
    "google": {
      "expectUserResponse": false,
      "richResponse": {
        "items": {
          "simpleResponse": {
            "textToSpeech": "test",
            "displayText": "test"
          }
        }
      }
    }
  }
}

【问题讨论】:

    标签: dialogflow-es


    【解决方案1】:

    在此评论https://stackoverflow.com/a/55238042/2197296 中找到了解决方案, 原来items 数组中的simpleResponse 元素必须包含在另一个数组中,如下所示:

    "webhookPayload": {
      "google": {
         "richResponse": {
         "items": [
            {
              "simpleResponse": {
                "displayText": "test",
                "textToSpeech": "test"
              }
            }
          ]
        },
        "expectUserResponse": false
      }
    },
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-16
      • 2020-04-12
      • 2017-01-19
      • 2017-01-05
      • 2013-03-11
      • 2019-09-07
      相关资源
      最近更新 更多