【问题标题】:Failed to parse Dialogflow response into AppResponse because of empty speech response for Ssml response由于 Ssml 响应的语音响应为空,无法将 Dialogflow 响应解析为 AppResponse
【发布时间】:2019-01-27 00:14:20
【问题描述】:

试图找出正确的 Dialogflow 实现 webhook json 响应。 Json 是由 AWS Lambda 上的 .NET Core 生成的。

{
  "fulfillmentText": "<speak><p>Welcome to Alterians News. I provide news that is of interest to Alterianss from a variety of sources, and on a variety of topics.</p> \r\n              <p>You can say <emphasis>read</emphasis>, then the topic name. For example, you could say <emphasis>read today's news</emphasis>, or <emphasis>read <prosody rate=\"112%\">Banking and Finance</prosody> news</emphasis>.</p> \r\n              <p>I cover the following Alterians news topics: house cats, Agriculture, \r\n              <prosody rate=\"112%\">Banking and Finance</prosody>, Party Politics, <prosody rate=\"112%\">Police and Crime</prosody>, and the Military</p></speak>",
  "fulfillmentMessages": null,
  "source": null,
  "payload": {
    "google": {
      "text": null,
      "expectUserResponse": false,
      "richResponse": {
        "items": [
          {
            "simpleResponse": {
              "textToSpeech": null,
              "displayText": null,
              "ssml": "<speak><p>Welcome to Alterians News. I provide news that is of interest to Alterianss from a variety of sources, and on a variety of topics.</p> \r\n              <p>You can say <emphasis>read</emphasis>, then the topic name. For example, you could say <emphasis>read today's news</emphasis>, or <emphasis>read <prosody rate=\"112%\">Banking and Finance</prosody> news</emphasis>.</p> \r\n              <p>I cover the following Alterians news topics: house cats, Agriculture, \r\n              <prosody rate=\"112%\">Banking and Finance</prosody>, Party Politics, <prosody rate=\"112%\">Police and Crime</prosody>, and the Military</p></speak>"
            }
          }
        ]
      },
      "SystemItent": null
    }
  },
  "outputContexts": null,
  "followupEventInput": null
}

我也试过这种格式:

{
    "payload":
    {
        "google":
        {
            "expectUserResponse":true,
            "richResponse":
            {
                "items":
                [
                    {
                        "simpleResponse":
                        {
                            "textToSpeech":"<speak><p>Welcome to Alterian News. I provide news that is of interest to Alterians from a variety of sources, and on a variety of topics.</p></speak>"
                        }
                    }
                ]
            }
        }
    }
}

谷歌模拟器上的操作的响应是:

{
  "responseMetadata": {
    "status": {
      "code": 10,
      "message": "Failed to parse Dialogflow response into AppResponse because of empty speech response",
      "details": [
        {
          "@type": "type.googleapis.com/google.protobuf.Value",
          "value": "{\"id\":\"f4fdf231-5316-454c-a969-6f36bd889d67\",\"timestamp\":\"2018-08-20T18:30:33.509Z\",\"lang\":\"en-us\",\"result\":{},\"status\":{\"code\":206,\"errorType\":\"partial_content\",\"errorDetails\":\"Webhook call failed. Error: 502 Bad Gateway\"},\"sessionId\":\"1534789833483\"}"
        }
      ]
    }
  }
}

模拟器的Error Tab有很多编码的Json,但我相信关键信息是:

由于为空,无法将 Dialogflow 响应解析为 AppResponse 语音反应

最后,错误选项卡包含以下内容:

必须设置 MalformedResponse 'final_response'。

我查看了 DialogFlow 实现 webhook 的示例并尝试遵循该示例。

有关于 Node.js 客户端库的综合文档,但关于使用 Ssml 的正确 Json 响应格式的文档不多。

任何帮助将不胜感激。 谢谢

【问题讨论】:

标签: dialogflow-es actions-on-google


【解决方案1】:

如果您要发回用于 Google 助理的回复:

  • 您可以省略 fulfillmentText 字段。
  • 应省略空字段。包括fulfillmentMessages,以及SimpleResponse 字段textToSpeechdisplayText

【讨论】:

  • 请问,fulfillmentText 字段什么时候使用? dialogflow.com/docs/fulfillment
  • 这没有帮助:-(
  • fulfillmentText 用于将 Dialogflow 用于除 Google Assistant 之外的其他集成。很遗憾听到它不起作用 - 您能否更新您的问题以包括现在不起作用的 JSON 以及您仍然遇到的确切错误?
  • 我已经用新的 Json 更新了这个问题。错误和/或错误消息没有改变
猜你喜欢
  • 1970-01-01
  • 2019-01-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-11-10
  • 1970-01-01
  • 1970-01-01
  • 2019-08-09
相关资源
最近更新 更多