我如何处理alexa中的内置意图

时间:2017-10-31 10:25:37

标签: alexa alexa-skills-kit alexa-skill

意图像"接下来,更早......更多..."在我的模型中所需的内置意图,我在代码中如何处理它们?我知道我应该委托,但我无法弄清楚如何做到这一点。请注意,这不是一个多圈对话框,因此对话状态始终为空!

SpeechletResponse speechletResp = new SpeechletResponse();

DelegateDirective dd = new DelegateDirective();
List<Directive> directiveList = new ArrayList<>();
directiveList.add(dd);
speechletResp.setDirectives(directiveList);
speechletResp.setNullableShouldEndSession(null);

return speechletResp;

有时代码返回错误,有时意图执行成功!

我不明白发生了什么,我的云监视器上没有出现任何消​​息!

1 个答案:

答案 0 :(得分:0)

它们可以像其他意图一样处理。所以,我发布了一个nodejs示例,您也可以轻松地在java中使用它。您必须在内置Intent之前添加 AMAZON

"SampleIntent": function() {
    console.log('ArtistSearchIntent HelpIntent');
    this.emit(":ask", "Know more about on google.com . Good 
    Bye!!", "Know more about on google.com . Good Bye!!");
}
"AMAZON.StopIntent": function() {
    console.log('ArtistSearchIntent StopIntent');
    this.emit(":tell", "Know more about on google.com. Good 
     Bye!!");
},
"AMAZON.CancelIntent": function() {
    console.log('ArtistSearchIntent CancelIntent');
    this.emit(":tell", "Know more about on google.com. Good 
    Bye!!");
},
"AMAZON.HelpIntent": function() {
    console.log('ArtistSearchIntent HelpIntent');
    this.emit(":ask", "Know more about on google.com . Good 
    Bye!!", "Know more about on google.com . Good Bye!!");
}