谷歌SSML上的操作无效

时间:2018-02-09 11:16:15

标签: node.js ssml

对谷歌 node.js 采取行动的

SSML 无效。它只是告诉值和 SSML标记

示例: <speak> Hello <break time="1s"/> All </speak> 它只是告诉标签“比说话的话少于打破时间等于.......”

2 个答案:

答案 0 :(得分:0)

假设您使用的是action-on-google npm软件包。

您可以在下面引用代码,

// Handle the Dialogflow intent named 'favorite color'.
// The intent collects a parameter named 'color'
app.intent('favorite color', (conv, {color}) => {
 const luckyNumber = color.length;
 const audioSound = 'https://actions.google.com/sounds/v1/cartoon/clang_and_wobble.ogg';
 if (conv.data.userName) {
   // If we collected user name previously, address them by name and use SSML
   // to embed an audio snippet in the response.
   conv.close(`<speak>${conv.data.userName}, your lucky number is ` +
     `${luckyNumber}.<audio src="${audioSound}"></audio></speak>`);
 } else {
   conv.close(`<speak>Your lucky number is ${luckyNumber}.` +
     `<audio src="${audioSound}"></audio></speak>`);
 }
});

有关更多详细信息,您可以检出Google Code Lab

答案 1 :(得分:0)

检查您的标签可能有一些错误。我遇到了同样的问题,结果是我错过了休息时间的正斜线。您可能会犯这样的错误。