【问题标题】:ssml in Dialogflow webhookDialogflow webhook 中的 ssml
【发布时间】:2019-10-03 02:16:49
【问题描述】:

这不是一个重复的问题,我没有得到确切的答复,所以在这里提出了一个新问题..

在 webhook 响应中写入 ssml 标签时遇到问题。

我之前的 webhook 响应:

{fulfillmentText: 'Amount for Invoice : TEST is $300'} - 它可以在所有界面上正常工作,例如 Web、Google 助理

现在我想使用 ssml,所以我尝试将 webhook 中的响应更新为

{"speech":"<speak>Amount for Invoice : TEST is $300<speak>","displayText":"Listen Voice.."}

这在 Dialogflow 端出错,因为我认为它无法读取响应。 有什么帮助吗?

注意:我正在使用 Google Cloud Function 将响应发送回 Dialogflow 引擎:

res.send(JSON.stringify({ 'fulfillmentText': output }));

【问题讨论】:

标签: google-cloud-platform google-cloud-functions webhooks dialogflow-es


【解决方案1】:

您应该将 json 中的 speech 键更改为 ssml。 请参阅下面的示例(source):

{  
   "payload":{  
      "google":{  
         "expectUserResponse":true,
         "richResponse":{  
            "items":[  
               {  
                  "simpleResponse":{  
                     "ssml":"<speak>Here are <say-as interpret-as=\"characters\">SSML</say-as> samples. I can pause <break time=\"3\" />. I can play a sound <audio src=\"https://actions.google.com/sounds/v1/alarms/winding_alarm_clock.ogg\">your wave file</audio>. I can speak in cardinals. Your position is <say-as interpret-as=\"cardinal\">10</say-as> in line. Or I can speak in ordinals. You are <say-as interpret-as=\"ordinal\">10</say-as> in line. Or I can even speak in digits. Your position in line is <say-as interpret-as=\"digits\">10</say-as>. I can also substitute phrases, like the <sub alias=\"World Wide Web Consortium\">W3C</sub>. Finally, I can speak a paragraph with two sentences. <p><s>This is sentence one.</s><s>This is sentence two.</s></p></speak>",
                     "displayText":"This is a SSML sample. Make sure your sound is enabled to hear the demo"
                  }
               }
            ]
         }
      }
   }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-11-10
    • 1970-01-01
    • 2018-08-19
    • 1970-01-01
    • 2018-07-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多