在 LUIS 中进行实体和意图识别后,为了向用户提供响应,机器人的逻辑是什么?
After the entity and intent recognition in LUIS, what can be the bot's logic in order to provide the response to the user?
例如,如果用户询问机器人 "whats the weather",luis 将识别实体,机器人将询问位置。之后,机器人必须从一个点中选择一个答案,并用一个答案回复用户。我无法对用户执行 'reply back with the answer'。
提前致谢。
您是否在对话中使用标准的瀑布方法?例如,以下代码摘自我构建的演示(用 TypeScript 编写):
bot.dialog("location", [
(sess, args, next) => {
builder.Prompts.choice(sess, "We are showing multiple results. Please choose one:", getEntities(builder, args));
},
(sess, results) => {
sess.send(new builder.Message(sess).addAttachment(dialogs.createHeroCard(sess, parser.findExact("title", results.response.entity))));
}
]).triggerAction({
matches: "location"
});
在此示例中,LUIS 中的意图被标记为 "location",因此 triggerAction
与之匹配。该对话框有两个功能。第一个在 LUIS returns 时调用,它显示一个包含多个选项的选择对话框。当用户选择其中一个选项时,结果将出现在第二个函数中。所以这包含两个问题。首先,用户询问在哪里举行特定的演讲活动,然后机器人 returns 一些符合意图的项目(可能 "bots" 在会议上有三个演示文稿)。它显示一个带有元素的选择对话框,用户的选择返回对话框(但在第二个函数中),并发送所选演示文稿的英雄卡。
在第一个实例中,机器人使用 builder.Prompts.choice()
来询问选择信息,第二个响应使用 session.send()
来显示结果。
在您的示例中,您可以使用 builder.Prompts.text()
来询问用户的位置,并在收到响应后(在瀑布的第二个函数中可用 results.response
,如果您的函数参数是session
和 results
),您将解析该数据,然后使用 session.send()
显示结果。
所以如果这被翻译成你的例子,你可能会做这样的事情:
bot.dialog("weather", [
(sess, args, next) => {
builder.Prompts.text(sess, "What location do you want weather for?");
},
(sess, results) => {
//Do something with the results
sess.send("Here's the weather!");
}
]).triggerAction({
matches: "weather"
});
例如,如果用户询问机器人 "whats the weather",luis 将识别实体,机器人将询问位置。之后,机器人必须从一个点中选择一个答案,并用一个答案回复用户。我无法对用户执行 'reply back with the answer'。
提前致谢。
您是否在对话中使用标准的瀑布方法?例如,以下代码摘自我构建的演示(用 TypeScript 编写):
bot.dialog("location", [
(sess, args, next) => {
builder.Prompts.choice(sess, "We are showing multiple results. Please choose one:", getEntities(builder, args));
},
(sess, results) => {
sess.send(new builder.Message(sess).addAttachment(dialogs.createHeroCard(sess, parser.findExact("title", results.response.entity))));
}
]).triggerAction({
matches: "location"
});
在此示例中,LUIS 中的意图被标记为 "location",因此 triggerAction
与之匹配。该对话框有两个功能。第一个在 LUIS returns 时调用,它显示一个包含多个选项的选择对话框。当用户选择其中一个选项时,结果将出现在第二个函数中。所以这包含两个问题。首先,用户询问在哪里举行特定的演讲活动,然后机器人 returns 一些符合意图的项目(可能 "bots" 在会议上有三个演示文稿)。它显示一个带有元素的选择对话框,用户的选择返回对话框(但在第二个函数中),并发送所选演示文稿的英雄卡。
在第一个实例中,机器人使用 builder.Prompts.choice()
来询问选择信息,第二个响应使用 session.send()
来显示结果。
在您的示例中,您可以使用 builder.Prompts.text()
来询问用户的位置,并在收到响应后(在瀑布的第二个函数中可用 results.response
,如果您的函数参数是session
和 results
),您将解析该数据,然后使用 session.send()
显示结果。
所以如果这被翻译成你的例子,你可能会做这样的事情:
bot.dialog("weather", [
(sess, args, next) => {
builder.Prompts.text(sess, "What location do you want weather for?");
},
(sess, results) => {
//Do something with the results
sess.send("Here's the weather!");
}
]).triggerAction({
matches: "weather"
});