由于Ssml响应的语音响应为空

由于Ssml响应的语音响应为空

本文介绍了由于Ssml响应的语音响应为空,无法将Dialogflow响应解析为AppResponse的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Trying to figure out the right Dialogflow fulfillment webhook json response.The Json is being generated by .NET Core on AWS Lambda.

{
  "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>"
                        }
                    }
                ]
            }
        }
    }
}

在Google模拟器上的操作是:

The response from the actions on google Simulator was:

{
  "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\"}"
        }
      ]
    }
  }
}

模拟器的错误选项卡上有很多经过编码的Json,但我相信关键信息是:

The Error Tab of the simulator has a lot of encoded Json but I believe the key information was:

最后,错误标签包含以下内容:

Finally, the Errors Tab contained the following:

我已经查看了DialogFlow实现Webhook的示例,并尝试遵循该示例。

I have looked at the samples for the DialogFlow fulfillment webhook and tried to follow that.

Node.js客户端库有全面的文档,但内容不多使用Ssml的正确Json响应格式。

There's comprehensive documentation of the Node.js client library, but not that much on the correct Json response formats that use Ssml.

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

Any help will be a appreciated.Thanks

推荐答案

如果您发回用于助手的答复:

If you're sending back a reply to be used for the Assistant:


  • 您可以忽略 fulfillmentText 字段。

  • 为null时应省略。包括 fulfillmentMessages 和SimpleResponse字段 textToSpeech displayText

  • You can omit the fulfillmentText field.
  • Fields that are null should be omitted. Including fulfillmentMessages, and the SimpleResponse fields textToSpeech and displayText.

这篇关于由于Ssml响应的语音响应为空,无法将Dialogflow响应解析为AppResponse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 11:45