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:-
“指令”:[{“类型”:“Dialog.ElicitSlot”,“slotToElicit”:“项目”}],