В моем агенте у меня есть три намерения, которые требуют подтверждения.
поток разговоров
user: my number is 000-000-0000
bot: is number 000-000-0000 correct, please confirm?
user: yes
bot: got your number, is your ${location.address} is correct, please confirm?
user: yes
bot: great got your number and address.
это мой код
app.intent('CustomerNumberIntent', (conv, parameters) => {
if (conv.user.storage.serviceType === 'Take Away') {
conv.ask(new Confirmation(`Is ${customerNumber} is correct number?`));
} else {
conv.close(`There might be some issue please try again!`);
}
});
app.intent('CustomerNumberConfirmationIntent', (conv, parameters, confirmationGranted) => {
if (confirmationGranted){
conv.contexts.set(AppContextsDefaultAddConfirm.AWAITING_DEFAULT_ADDRESS_CONFIRMATION, 1);
conv.ask(new Confirmation(`You want delivery at ${defaultAddress}. Is that right?`));
} else {
conv.ask(`Tell me the correct contact number?`);
}
});
app.intent('CustomerAddressConfirmationIntent', (conv, parameters, confirmationGranted) => {
const contexDefaultAddConfirm = conv.contexts.get(AppContextsDefaultAddConfirm.AWAITING_DEFAULT_ADDRESS_CONFIRMATION);
const contexUserAddConfirm = conv.contexts.get(AppContextsUserAddConfirm.AWAITING_USER_ADDRESS_CONFIRMATION);
if (confirmationGranted){
conv.close(`Great! I got your number and address.`);
} else {
conv.ask(`Where to deliver your order?`);
}
});
app.intent('CustomerAddressIntent', (conv, parameters) => {
conv.contexts.set(AppContextsUserAddressConfirmation.AWAITING_USER_ADDRESS_CONFIRMATION, 1);
const deliveryAddress = parameters.deliveryAddress;
if (conv.user.storage.serviceType === 'Home Delivery'){
conv.ask(new Confirmation(`Your delivery address is ${deliveryAddress}, please confirm?`));
} else {
conv.close(`There might be some issue please try again!`);
}
});
нужна помощь в получении этого поток разговоров, не знаю, как обрабатывать эти два подтверждения.
Я также добавил контексты, но это не сработало.