Amazon Lex Calls Wrong Lambda Function -


while working on test lexbot orders pizza, had error lexbot calling wrong lambda function , outputs result.

i have 2 intents, "orderpizzasize" , "orderpizzatoppings".

the orderpizzasize intent has slot type pizzasize. slot type contains values "small pizza", "medium pizza", , "large pizza". lambda function orderpizzasize intent calls fulfillment "orderpizza". code below:

    exports.handler = (event, context, callback) => {     var pizzasizechoice = event.currentintent.slots.pizzasize;     var price = "free";          if (pizzasizechoice == "small pizza"){             price = "6 dollars";         }         else if (pizzasizechoice == "medium pizza"){             price = "8 dollars";         }         else if (pizzasizechoice == "large pizza"){             price = "10 dollars";         }         else {             price = "11 dollars";         }      callback(null, {         "dialogaction": {         "type": "close",         "fulfillmentstate": "fulfilled",         "message": {             "contenttype": "plaintext",             "content": "you have ordered " + event.currentintent.slots.pizzasize + " " + price + ". toppings? ask!"         }     } }); }; 

this lambda function works fine when of utterances orderpizzasize said user. output "you have ordered large pizza 10 dollars. toppings? ask!"

the problem occurs when utterances orderpizzatoppings intent called. orderpizzatoppings intent calls lambda function "orderpizzatoppings". code function below:

exports.handler = (event, context, callback) => {     var pizzatoppingschoice = event.currentintent.slots.pizzatoppings;     var price = "free";          if (toppings == "mushrooms"){             price = "1 dollar";         }         else if (pizzatoppingschoice == "peppers"){             price = "2 dollars";         }         else if (pizzatoppingschoice == "onions"){             price = "3 dollars";         }         else if (pizzatoppingschoice == "sausage"){             price = "4 dollars";         }         else if (pizzatoppingschoice == "extra cheese"){             price = "5 dollars";         }         else if (pizzatoppingschoice == "pepperoni"){             price = "6 dollars";         }         else {             price = "10 dollars";         }         callback(null, {         "dialogaction": {         "type": "close",         "fulfillmentstate": "fulfilled",         "message": {             "contenttype": "plaintext",             "content": "you put " + event.currentintent.slots.pizzatoppings + " " + price + "."         }     } }); }; 

when orderpizzatoppings utterances said, output "you have ordered undefined 11 dollars. toppings? ask!" still seems calling first orderpizza lambda function associated orderpizzasize intent rather correct lambda function orderpizzatoppings.

the strange part when removed lambda function orderpizza, changed option "return parameters client" , rebuilt bot, still output "you have ordered undefined 11 dollars. toppings? ask!" despite lambda function not being called.

does know why lex still responding "orderpizza" lambda function?


Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -