我的 Alexa 应用程序的一些 Intent 需要特定的插槽。Alexa 技能构建器让这一切变得简单。我可以根据需要标记一个插槽并设置 Alexa 应该询问的内容,以便用户提供该插槽的信息。问题是,作为开发人员,您必须用您的 lambda 告诉 Alexa 您希望 Alexa 处理插槽填充。
阅读文档,我进入了这一部分:
它指出
如果对话框是 IN_PROGRESS,则返回没有 updatedIntent 的 Dialog.Delegate。
我该怎么做呢?在我的 lambda 我有
@Override
public SpeechletResponse onIntent(final IntentRequest request, final Session session)
throws SpeechletException {
Intent intent = request.getIntent();
String intentName = (intent != null) ? intent.getName() : null;
if ("AddTwoNumbers".equals(intentName)) {
if (!request.getDialogState().equals("COMPLETED")) {
return new DelegateDirective();
} else {
handleAdditionIntent();
}
} else { // handle other intents}
}
他们的代码示例似乎也没有太大帮助。
} else if (intentRequest.dialogState != "COMPLETED"){
// return a Dialog.Delegate directive with no updatedIntent property.
} else {