Alexa 技能让用户确认插槽值

Alexa skill have user confirm slot values

我在 lambda 函数中使用 Node.js 构建 Alexa 技能,但找不到任何关于确认槽中数据的最佳方法的教程。我已经到了所有插槽现在都有数据的地步,但想让 Alexa 读回请求并在继续之前得到用户的确认。执行此操作的最佳和正确方法是什么?

起初我想使用 emit 和 :elicitSlot 但后来我需要一个新插槽来执行此操作,它看起来很老套。

例如:

if(all slots have a valid value){
this.emit(':elicitSlot','confirm',"You're request is .... with data .... is this correct?");
}
if(user confirmed data is valid){
// do something
}else{
// the data was not correct get the right data
}

对于整个意图确认,勾选 here. For only slot confirmation, check here

另外,对于你的后续问题,

can the confirmation for the skill and slots be fine tuned for example if one of the slots is something like a name and alexa knows 100% what name I said can it skip the confirmation?

简短回答 - 如果您不维护对话框,当然可以。但是,强烈建议不要依赖它。

为了保持对话,您必须监视意图请求的 dialogState 属性,并且只要它不处于状态 COMPLETED 就发送具有属性 directives 的响应[{'type': 'Dialog.Delegate'}] 以保持流畅。您可以更好地控制对话框 - 请参阅 this doc。此外,强烈建议您在这些回复中省略 outputSpeechreprompt,否则 Alexa 会不高兴。一旦对话状态为 COMPLETED,您将获得 confirmationStatus(对于 Intent 和插槽)- SUCCESS(?)/DENIED/NONE。如果确认不成功。我已经看到多个匹配项作为回复发送。但是,当成功时,只返回匹配的插槽值。

P.S。我有这个奇怪的问题。当 Alexa 要求确认一个槽值时,如果我连续两次故意拒绝,它就会放弃,什么都不做!虽然,几乎 99% 的时间 Alexa 都在现场。

P.P.S。事实证明,2 次尝试是 Alexa 的硬性限制。这应该在下一次迭代中得到改进。