【问题标题】:Dialog.ElicitSlot is running in a loop how to end and start dialogue again in alexa ?Dialog.ElicitSlot 循环运行如何在 alexa 中结束并再次开始对话?
【发布时间】:2018-10-26 08:07:08
【问题描述】:
function delegateSlotCollection(){
 console.log("current dialogState: "+this.event.request.dialogState);
   if (this.event.request.dialogState === "STARTED") {
     var updatedIntent=this.event.request.intent;
     this.emit(":delegate", updatedIntent);
   } else if (this.event.request.dialogState !== "COMPLETED") {
     console.log("in not completed");
      if(this.event.request.intent.slots.customername.value) {
            let prompt = "Please Tell Me your Item name  ";
            let reprompt = "";
            console.log("Printed");
            this.emit(':elicitSlot', 'item', prompt, reprompt); 
      }

   } else {

     return this.event.request.intent;
   }
}

运行此代码后,它会询问客户名称,然后它会引出项目值,然后当我输入项目值时,它会进入一个循环并一次又一次地询问项目值如何打破这个?

输出 json :-

“指令”:[ { "type": "Dialog.ElicitSlot", "slotToElicit": "项目" }],

【问题讨论】:

    标签: node.js aws-lambda alexa alexa-skills-kit alexa-slot


    【解决方案1】:
    function delegateSlotCollection(){
     console.log("current dialogState: "+this.event.request.dialogState);
       if (this.event.request.dialogState === "STARTED") {
         var updatedIntent=this.event.request.intent;
         this.emit(":delegate", updatedIntent);
       } else if (this.event.request.dialogState !== "COMPLETED") {
         console.log("in not completed");
         if (this.event.request.intent.slots.item.value) {
             this.emit(":delegate");
         }
          else if(this.event.request.intent.slots.customername.value) {
                let prompt = "Please Tell Me your Item name HELLO  ";
                let reprompt = "";
                console.log("Printed");
                this.emit(':elicitSlot', 'item', prompt, reprompt); 
          }
    
       } else {
    
         return this.event.request.intent;
       }
    }
    

    好的,发现这个解决方案有效

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-03-07
      • 1970-01-01
      • 2016-11-14
      • 1970-01-01
      • 2018-03-31
      • 2013-06-15
      • 2022-07-24
      • 2019-03-30
      相关资源
      最近更新 更多