谷歌node.js上的SSML不起作用。它只是将值与SSML tag一起告知。
示例: <speak> Hello <break time="1s"/> All </speak>
它只是告诉标签“小于说大于你好小于休息时间等于.......”
检查你的标签可能有一些错误。我遇到了同样的问题,结果我在休息时间错过了正斜杠。你可能犯了一些这样的错误。
假设您正在使用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