我之前也曾问过这个问题,但没有运气,所以我再次发帖。我正在研究amazon alexa技能,我希望当我称之为'YESNOIntent'时,它应该在不同意图下回答不同。
'FirstIntent': function () {
speechoutput = 'bla bla, would you like to know anything else?'
this.emit(":ask", speechOutput)
},
'YESNOIntent': function (){
speechoutput = 'speech1'
this.emit(":ask", speechOutput)
},
'SecondIntent': function () {
speechoutput = 'bla bla, would you like to know anything else?'
this.emit(":ask", speechOutput)
},
'YESNOIntent': function (){
speechoutput = 'speech2'
this.emit(":ask", speechOutput)
},
'ThirdIntent': function () {
speechoutput = 'bla bla, would you like to know anything else?'
this.emit(":ask", speechOutput)
},
'YESNOIntent': function (){
speechoutput = 'speech3'
this.emit(":ask", speechOutput)
},
......等等
是和否是两件不同的事情。你不能将这两个合并为一个YesNoIntent
。正如我在previous answer中所说,你应该使用AMAZON.YesIntent
和AMAZON.NoIntent
。
利用sessionAttributes
来跟踪“你在谈话中的位置”,以便在触发AMAZON.YesIntent
或AMAZON.NoIntent
处理程序时给出正确的响应。