Dialogue.Directive 发出处理程序时不工作?

Dialogue.Directive Not Working When emiting the handler ?

在对话完成并且它的 confirmationStatus 更改为 confirmed 之后我发出另一个对话指令 ./intent 但它的指令 dosent 工作并且它直接跳转到发出并结束

代码:-

const handlers = {
    'LaunchRequest': function () {
        this.response.speak(welcomeOutput).listen(welcomeReprompt);
        var userID = this.event.session.user.userID;
        console.log(userID);
        this.emit(':responseReady');
    },
    'createOrder': function () {

        var filledSlots = delegateSlotCollection.call(this);
        this.emit(':tell','Create Order Ended');
    },
    'addOrder': function () {
        var filledSlots = delegateSlotCollectionSecond.call(this);

    },
    'AMAZON.HelpIntent': function () {
        speechOutput = "";
        reprompt = "";
        this.response.speak(speechOutput).listen(reprompt);
        this.emit(':responseReady');
    },
    'AMAZON.YesIntent': function () {
        this.emit("Yes Triggered");
    },
    'AMAZON.NoIntent': function () {
        this.emit("NO Triggered");
    },
    'AMAZON.CancelIntent': function () {
        speechOutput = "Okay Your Request is Cancelled";
        this.response.speak(speechOutput);
        this.emit(':responseReady');
    },
    'AMAZON.StopIntent': function () {
        speechOutput = "";
        this.response.speak(speechOutput);
        this.emit(':responseReady');
    },
    'SessionEndedRequest': function () {
        var speechOutput = "";
        this.response.speak(speechOutput);
        this.emit(':responseReady');
    },
    'AMAZON.FallbackIntent': function () {
        console.log('AMAZON FALL BACKINTENT');
    },
    'Unhandled': function () {
        console.log("Unhandled");
    },
};

exports.handler = (event, context) => {
    var alexa = Alexa.handler(event, context);
    alexa.appId = APP_ID;
    // To enable string internationalization (i18n) features, set a resources object.
    //alexa.resources = languageStrings;
    alexa.registerHandlers(handlers);
    alexa.execute();
};

//    END of Intent Handlers {} ========================================================================================
// 3. Helper Function  =================================================================================================

function delegateSlotCollection() {
    console.log("in 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");
        this.emit(":delegate")
    } else {
        if (this.event.request.intent.confirmationStatus === 'CONFIRMED'){
           this.emit('addOrder');
        }
        return this.event.request.intent;
    }
}


function delegateSlotCollectionSecond() {
    console.log("in 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");
        this.emit(":delegate")
    } else {
        if (this.event.request.intent.confirmationStatus === 'CONFIRMED'){
            Console.log("Vegeta");
             console.log(this.event.request.intent.confirmationStatus);
        }
        return this.event.request.intent;
    }
}

这是我正在使用的代码,所以当第一个 createOrder 对话完成时,它要求确认,当我说是时,添加订单被发出,但它的对话指令没有工作,它直接发出语句,所以如何解决 tghis问题 ?

    'createOrder': function () {     
         this.emit(':ask','tell me item name');
        },
     'productIntent': function(){
         this.event.request.intent.slots.product.value //have an intent and slot for product 
         this.attributes['anyName'] = "product"; put product in session
         this.emit(':ask','tell me quantity');
      } 
     'quantityIntent': function(){
         this.event.request.intent.slots.quantity.value //have an intent and slot for quality
         this.attributes['anyName'] = "quantity"; put quantity in session
         this.emit(':ask','do you want to add more item');
     }
      'Amazon.yesIntent': function () {
            this.emit("createOrder"); //repeat
    }, 
//handle no intent by retrieving all data and making your order
let retriveddata = this.attributes['anyName'];

你懂的。 这样,除非会话结束,否则您不会丢失意图之间的数据。

{
    "interactionModel": {
        "languageModel": {
            "invocationName": "hello order",
            "intents": [
                {
                    "name": "AMAZON.FallbackIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.CancelIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.HelpIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.StopIntent",
                    "samples": []
                },
                {
                    "name": "CreateOrder",
                    "slots": [],
                    "samples": []
                },
                {
                    "name": "ProductIntent",
                    "slots": [
                        {
                            "name": "productType",
                            "type": "products"
                        }
                    ],
                    "samples": [
                        "{productType}"
                    ]
                },
                {
                    "name": "QuanityIntent",
                    "slots": [
                        {
                            "name": "quantiyValue",
                            "type": "AMAZON.NUMBER"
                        }
                    ],
                    "samples": [
                        "{quantiyValue}"
                    ]
                },
                {
                    "name": "AMAZON.YesIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.NoIntent",
                    "samples": []
                }
            ],
            "types": [
                {
                    "name": "products",
                    "values": [
                        {
                            "name": {
                                "value": "burger"
                            }
                        },
                        {
                            "name": {
                                "value": "pizza"
                            }
                        }
                    ]
                }
            ]
        }
    }
}