Amazon Lex chatbot插槽出现故障

编程入门 行业动态 更新时间:2024-10-06 06:42:17
本文介绍了Amazon Lex chatbot插槽出现故障的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试创建一个聊天机器人.聊天机器人将提示您您的国籍是什么?(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插槽出现故障

本文发布于:2023-11-28 03:30:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1640787.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:插槽   出现故障   Amazon   Lex   chatbot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!