问题描述
我正在使用Aws Lex构建聊天机器人.我遇到的情况是,最初需要在没有用户输入的情况下收到欢迎消息,以便我可以在聊天机器人中为用户提供指导.
I am using Aws Lex for constructing chatbots. I had a scenario where I need to have welcome message initially without user input so that I can give a direction to the user in my chatbot.
推荐答案
您需要使用API调用来处理该方案,以与您的用户启动上下文.
You need to work that scenario using API call to start a context with your user.
您可以按照以下步骤操作:
- 您需要创建一个名为
AutoWelcomeMessage
的Intent. - 创建一个仅包含一个值的
Slot type
,即:HelloMe
. - 创建话语
HelloMessage
. - 创建
Slot
如下:必填,名称:answer
,插槽类型:HelloMe
,提示:'AutoWelcomePrompt'. - 为您的
Fulfillment
选择Amazon Lambda,它将发送响应给您的用户.即:
- You need to create an Intent called
AutoWelcomeMessage
. - Create a
Slot type
with only one value i.e:HelloMe
. - Create an Utterances
HelloMessage
. - Create a
Slot
as follow: Required, name:answer
, Slot Type:HelloMe
, Prompt: 'AutoWelcomePrompt'. - Pick Amazon Lambda for your
Fulfillment
that will send a response to your user. I.e:
您好,我可以帮您吗? (该用户将在此处输入另一个Intent
,您的Bot会回复).
Hello user, may I help? (Here the user will enter another Intent
and your Bot will respond).
现在,与您的用户开始对话,只需通过API调用Lex Bot并发送带有Intent AutoWelcomeMessage
的意图,该调用将启动与Lex Bot的上下文,而fulfillment
将执行您的Lambda.
Now, start a conversation with your User, just call via API your Lex Bot and send an intention with Intent AutoWelcomeMessage
, that call starts a context with your Lex Bot and the fulfillment
will execute your Lambda.
这篇关于如何在AWS Lex中获取欢迎消息(Python中的lambda)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!