dialogflow-es - 由于 Ssml 响应的语音响应为空,无法将 Dialogflow 响应解析为 AppResponse
问题描述
试图找出正确的 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>"
}
}
]
}
}
}
}
google Simulator 上的操作的响应是:
{
"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,但我相信关键信息是:
由于语音响应为空,无法将 Dialogflow 响应解析为 AppResponse
最后,错误选项卡包含以下内容:
必须设置 MalformedResponse 'final_response'。
我查看了 DialogFlow 实现 webhook 的示例并尝试遵循该示例。
有 Node.js 客户端库的综合文档,但关于使用 Ssml 的正确 Json 响应格式的文档不多。
任何帮助将不胜感激。谢谢
解决方案
如果您要发回用于 Google 助理的回复:
- 您可以省略该
fulfillmentText
字段。 - 应省略为空的字段。包括
fulfillmentMessages
, 和 SimpleResponse 字段textToSpeech
和displayText
.
推荐阅读
- html - 如何重叠 2 个 CSS 项目并使 1 个项目位于最前面
- minio - 使用 MinIO 时是否可以完全禁用身份验证?
- apache-kafka - 如何延迟 Spring Cloud Stream StreamListener 的初始化?
- scala - 合并数据集中的行
- google-cloud-functions - Quarkus:使用 Google Cloud Functions 时 CDI 不工作
- audio - 使用多个音频流ffmpeg时不能使用-shortest参数
- c# - UWP 绑定分层对象的特定属性
- html - 当高度和宽度是百分比时,如何用 CSS 绘制半圆?
- c++ - 从 QDoc setHtml 中提取 html 标签数据
- pdf - 带有 TSA 时间戳的数字签名在 TSA 响应 PDF 框中添加链中证书,给出错误“没有足够的空间来写入签名”