我正在尝试根据提到的here教程创建Alexa技能。我是用Alexa-Hosted Skill创建的。当我打开我的技能时,我没有说“你好”,而是收到一条错误消息,说“所请求技能的响应存在问题”
代码与GitHub repo的src目录中提到的完全相同。如果您仍然需要查看它,请告诉我,我可以将其粘贴在此处。
我有两个问题:
:ask
和:tell
指令是什么,但我找不到文档。我检查了Alexa提供的几个样本回购(像这些:fact skill,trivia skill,how to skill),但每个样本使用ResponseBuilder创建技能,这是documented here,但我没有找到文档广泛。有人可以告诉我它们是什么,我在哪里可以找到更多关于它们的文档?在上述GitHub仓库中使用的alexa-sdk软件包已被弃用,您不应该使用它。
你应该使用alexa-sdk-core。
如果您想播放音频,那么您可以在Alexa技能的代码编辑器中创建如下的意图处理程序,
const PlayAudioIntent = {
canHandle(handlerInput) {
return handlerInput.requestEnvelope.request.type === 'IntentRequest'
&& handlerInput.requestEnvelope.request.intent.name === 'PlayAudioIntent';
},
handle(handlerInput) {
const audioFile = '<audio src="https://s3.amazonaws.com/cdn.dabblelab.com/audio/one-small-step-for-man.mp3" />';
const speechText = `Hello ${audioFile}`;
return handlerInput.responseBuilder
.speak(speechText)
//.reprompt('add a reprompt if you want to keep the session open for the user to respond')
.getResponse();
}
};