问题描述
我正在尝试为Amazon lex做一个if语句,其中如果用户对问题1回答"A",则用户的下一个问题将是问题2,但是当用户回答"B"时,则将用户带到问题3.例如,
示例1:
Lex:你喜欢冰淇淋吗?"
用户:是"
Lex:什么味道"?
示例2:
Lex:你喜欢冰淇淋吗?"
用户:否"
Lex:你喜欢蛋糕吗?"
我知道我必须在aws lambda(python)中进行验证,但是我不确定如何执行此代码.
首先,取消选中lex上该冰淇淋味插槽的require按钮(您可以在lambda中进行验证).
当填入对冰淇淋y/n的答复时,您将检查该值是否为no,在这种情况下,您会将冰淇淋风味的值分配给N/A,并引起下一个问题的答复./p>
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.
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.
这篇关于使用AWS Lambda(python)来执行Amazon Lex的if语句时遇到麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!