args 在实施 BotAuth 后未返回预期的 LUIS 结果
args not returning expected LUIS result after implementing BotAuth
我一直在使用 Nodejs 和 LUIS 中的 MS Bot Framework 创建一个聊天机器人。我最近试图从 MS Graph API 获取某些信息,并且已经(某种程度上)成功实施 BotAuth 并且能够获取我想要的信息。
我现在面临的问题是,对于实现 BotAuth 的对话框,我无法获得通常的 args
随 LUIS 意图触发的对话框。因此,我无法获得用户可能输入的任何 entities
。其他未实现 BotAuth 的对话框对此没有问题。
我现在从 args
得到的是:
{ response: undefined, resumed: 4 }
我猜测问题出在本节中的 [].concat
部分:
bot.dialog('refreshSchDialog-oauth', [].concat(
ba.authenticate("aadv2"),
(session, args, skip) => {
let user = ba.profile(session, "aadv2");
session.endDialog(user.displayName);
session.userData.accessToken = user.accessToken;
session.userData.refreshToken = user.refreshToken;
console.log('args');
console.log(args);
if (user.accessToken) {
session.send('got leh');
// valid access token, check if luis has any entities (MV name)
// if there is, store conversationData and move to next dialog
if (args.entities) {
for (i = 0; i < args.entities.length; i++) {
if (args.entities[i].type == 'dbName') {
session.conversationData.mvName = args.entities[i].entity;
session.send(args.entities[i].entity);
}
}
}
session.beginDialog('refreshSchDialog');
} else {
// no valid access token
// TODO error message
}
}))
.triggerAction({
matches: 'refreshSchema',
intentThreshold: 0.3
});
我可以知道为什么 args
没有从 LUIS 返回信息吗?
查看 BotAuth 代码,似乎 Auth 对话框 returns 用户如果正确通过身份验证,或者如果对话框失败则为 false。它不会从 LUIS 复制参数。我会更改您的代码,以便瀑布中的第一个函数将 LUIS 数据存储到 session.dialogData
,然后调用 ba.authenticate
,然后在最后一个瀑布步骤中使用这两个结果。
我一直在使用 Nodejs 和 LUIS 中的 MS Bot Framework 创建一个聊天机器人。我最近试图从 MS Graph API 获取某些信息,并且已经(某种程度上)成功实施 BotAuth 并且能够获取我想要的信息。
我现在面临的问题是,对于实现 BotAuth 的对话框,我无法获得通常的 args
随 LUIS 意图触发的对话框。因此,我无法获得用户可能输入的任何 entities
。其他未实现 BotAuth 的对话框对此没有问题。
我现在从 args
得到的是:
{ response: undefined, resumed: 4 }
我猜测问题出在本节中的 [].concat
部分:
bot.dialog('refreshSchDialog-oauth', [].concat(
ba.authenticate("aadv2"),
(session, args, skip) => {
let user = ba.profile(session, "aadv2");
session.endDialog(user.displayName);
session.userData.accessToken = user.accessToken;
session.userData.refreshToken = user.refreshToken;
console.log('args');
console.log(args);
if (user.accessToken) {
session.send('got leh');
// valid access token, check if luis has any entities (MV name)
// if there is, store conversationData and move to next dialog
if (args.entities) {
for (i = 0; i < args.entities.length; i++) {
if (args.entities[i].type == 'dbName') {
session.conversationData.mvName = args.entities[i].entity;
session.send(args.entities[i].entity);
}
}
}
session.beginDialog('refreshSchDialog');
} else {
// no valid access token
// TODO error message
}
}))
.triggerAction({
matches: 'refreshSchema',
intentThreshold: 0.3
});
我可以知道为什么 args
没有从 LUIS 返回信息吗?
查看 BotAuth 代码,似乎 Auth 对话框 returns 用户如果正确通过身份验证,或者如果对话框失败则为 false。它不会从 LUIS 复制参数。我会更改您的代码,以便瀑布中的第一个函数将 LUIS 数据存储到 session.dialogData
,然后调用 ba.authenticate
,然后在最后一个瀑布步骤中使用这两个结果。