Amazon Lex 聊天机器人槽的问题

Trouble with Amazon Lex chatbot slots

我正在尝试创建一个聊天机器人。 Chatbot 会提示问题 "What is your nationality? (A, B, C)",如果用户说 C,我想直接说 "I am sorry, C is not applicable to apply. Only A and B can apply." 之类的话来结束聊天 我知道我必须在说完之后取消选中 "required" 复选框问题,但我不确定要在 aws lambda 中输入什么才能让它发生。

取消选中所需的复选框后,在 lambda 代码中执行以下操作:

# 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
    }
}

您可能想看看 , , , this documentation 等..

试一试,查看文档了解其他内容,并对进一步的疑问发表评论。

希望对您有所帮助。