Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
645 views
in Technique[技术] by (71.8m points)

Having trouble to do if statement for Amazon Lex using AWS Lambda (python)

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...