我正在尝试创建一个聊天机器人.聊天机器人将提示您您的国籍是什么?(A,B,C)",如果用户说"C",我想通过说抱歉,C不适用于此申请"来结束聊天.只有A和B可以申请."我知道我必须在上述问题之后取消选中必需"复选框,但是我不确定要在AWS Lambda中输入什么才能实现.
I am trying to create a chatbot. Chatbot will prompt the question "What is your nationality? (A, B, C)" and if the user says C, I want to straight away end the chat by saying something like "I am sorry, C is not applicable to apply. Only A and B can apply." I know I have to uncheck the "required" checkbox after the said question but I'm not sure what to input in aws lambda for it to happen.
推荐答案
取消选中所需的复选框后,在lambda代码中执行以下操作:
After unchecking the required checkbox, in the lambda code do below:
# inside dialogcodehook slots = intent_request['currentIntent']['slots'] nation = slots['nation'] if nation == 'C': return close('I am sorry, C is not applicable to apply. Only A and B can apply.') # rest of your code def close(msg): "dialogAction": { "type": "Close", "fulfillmentState": "Fulfilled", "message": { "contentType": "PlainText", "content": msg } }您可能希望查看此问题,此问题,这个问题,本文档等.
You may want to see this question, this question, this question, this documentation etc..
尝试使用它,查看文档了解其他内容,并提出进一步的疑问.
Play with it and see documentation for other things and comment for further doubts.
希望有帮助.
更多推荐
Amazon Lex chatbot插槽出现故障
发布评论