我正在尝试制作一个 Alexa 技能,其中 Alexa 说了一些用 SSML 标记的东西。我试图模仿这个repo中的例子,但我总是收到一个 lambda 响应
{
...
"response": {
"outputSpeech": {
"type": "SSML",
"ssml": "<speak> [object Object] </speak>"
},
...
}
和 Alexa 字面意思是“对象对象”。
这是我输入到我的 lambda 函数的内容(使用 node.js):
var speechOutput = {
type: "SSML",
ssml: 'This <break time=\"0.3s\" /> is not working',
};
this.emit(':tellWithCard', speechOutput, SKILL_NAME, "ya best not repeat after me.")
像这样设置 SpeechOutput 也不起作用:
var speechOutput = {
type: "SSML",
ssml: 'This <break time=\"0.3s\" /> is not working',
};
编辑:
index.js
'使用严格';
var Alexa = require('alexa-sdk');
var APP_ID = "MY_ID_HERE";
var SKILL_NAME = "MY_SKILL_NAME";
exports.handler = function(event, context, callback) {
var alexa = Alexa.handler(event, context);
alexa.APP_ID = APP_ID;
alexa.registerHandlers(handlers);
alexa.execute();
};
var handlers = {
'LaunchRequest': function () {
this.emit('Speaketh');
},
'MyIntent': function () {
this.emit('Speaketh');
},
'Speaketh': function () {
var speechOutput = {
type: "SSML",
ssml: 'This <break time=\"0.3s\" /> is not working',
};
this.emit(':tellWithCard', speechOutput, SKILL_NAME, "some text here")
}
};
有人知道我哪里出错了吗?