问题
I am trying to do an if statement for amazon lex where if a user answers 'A' for question 1, user's next question will be question 2 but when user answers 'B', the user is brought to question 3 instead. For example,
Example 1:
Lex: "Do you like ice cream?"
User: "Yes"
Lex: "What flavour"?
Example 2:
Lex: "Do you like ice cream?"
User: "No"
Lex: "Do you like cake?"
I know I have to do the validation in aws lambda (python) but I am not really sure what the code is for this to happen.
回答1:
First, uncheck the require button on lex for that ice cream flavor slot (you can do the validation in lambda).
When the response for ice cream y/n is populated you would check to see if the value is no in which case you would assign the value of the ice cream flavor to N/A and elicit response for the next question.
来源:https://stackoverflow.com/questions/47132680/having-trouble-to-do-if-statement-for-amazon-lex-using-aws-lambda-python