如何在alexa中设置上下文

问题描述 投票:0回答:1

我在Dialogflow上工作,在那里我已经为自己的意图设置了上下文,但是不知道如何在Alexa中设置上下文

user: open demo bot
alexa: welcome! How can I help you?

User: update my name
Alexa: What's your name?

User: Jason
Alexa: your name is updated as Jason, Anything else?

user: John
Alexa: your name is updated as John, Anything else?

它应该给出一个错误,但它会直接更新名称(John)。

示例2

user: open demo bot
alexa: welcome! How can I help you? (WelcomeIntent)

user: order food
alexa: We offer item1, item2. What you would like to have? (FoodItemIntent)

user: item2
alexa: you have ordered item2, your order will be served soon. (OrderFoodIntent)

在这里完成食物订购会议

现在是否用户再次说出类似的食物

user: item1
alexa: you have ordered item1, your order will be served soon. (OrderFoodIntent)

它不应该直接更新订购的商品,它应该提示一条错误消息,例如“我没有得到,您可以要求我订购食物或更新名称”

因为食品订购会话已完成。

chatbot alexa alexa-skill
1个回答
0
投票

[在Alexa中,目前不像在Dialogflow中那样容易。但是您可以在服务器端进行操作,在此可以模拟上下文。

例如,在Alexa的响应/请求中,您将存储意图历史记录和值。基于此,您可以在服务器端构建上下文。就像收到不适合上下文的意图时一样,您将向用户发送提示,要求您说什么。为此,我建议一些通用的意图,例如与文本匹配的text_intent或用于数字的number_intent等...

或者,如果您能以某种方式获得用户要求的内容(非意图)时将其置于不同的级别,则该语句将通过dialogflow NLU API发送,并根据该语句获得上下文答案。

© www.soinside.com 2019 - 2024. All rights reserved.