gpt4 book ai didi

java - 如何在Alexa Skill + Lambda + Js中使用SSML

转载 作者:行者123 更新时间:2023-11-29 08:36:24 25 4
gpt4 key购买 nike

我正在尝试在我的 Alexa Skill 中使用 SSML。我使用 Lambda 作为我的服务端点,并使用 Js 对其进行编程。现在我的问题是,我如何在我的技能中正确地实现它?我正在使用以下函数来使用 SSML:

function buildSSMLSpeechletResponse(title, output, repromptText, shouldEndSession) {
return {
outputSpeech: {
type: "SSML",
ssml: output
},
card: {
type: "Simple",
title: "SessionSpeechlet - " + title,
content: "SessionSpeechlet - " + output
},
reprompt: {
outputSpeech: {
type: "SSML",
text: repromptText
}
},
shouldEndSession: shouldEndSession
};
}

我的代码:

function onLaunch(launchRequest, session, callback) {
console.log("onLaunch requestId=" + launchRequest.requestId
+ ", sessionId=" + session.sessionId);

var cardTitle = "Hello, World!";
var speechOutput = { type: "SSML",
ssml: "<speak>Welcome to Hubo help. <amazon:effect name='whispered'>You can ask questions like</amazon:effect>: 'How do I paint a wall?'. Now what can I help you with?.</speak>", };
callback(session.attributes,
buildSSMLSpeechletResponse(cardTitle, speechOutput, "", true));
}

我想我在回调时犯了一个错误?提前致谢!

最佳答案

如果您使用的是 Alexa Skills Kit SDK for Node.js您可以只在要发出的文本中包含 SSML 标记。

例如:

this.emit(':tell', 'Sometimes when I look at the Alexa skills you have all taught me, I just have to say, <say-as interpret-as="interjection">Bazinga.</say-as><break time="0.3s"/><amazon:effect name="whispered"> I love it. </amazon:effect>')

this.emit(':tell', '<say-as interpret-as="interjection">Oh boy</say-as><break time="1s"/> this is just an example.')

它将包含在 README.md 文件中,有 this现在的 PR

关于java - 如何在Alexa Skill + Lambda + Js中使用SSML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43844826/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com