我在nodejs和luis中创建了一个带有ms-bot框架的聊天机器人。我最近正在尝试从ms-graph-api获取某些信息,并且已经(某种程度上)成功实现了BotAuth,并且能够获得我想要的信息。
我现在面临的问题是,对于实现botauth的对话框,我无法获得luis intents触发的对话框所附带的通常args
。因此,我无法获取用户可能输入的任何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对话框将返回用户;如果对话框失败,则返回false。它不会复制路易斯的参数。我将更改您的代码,以便瀑布中的第一个函数将luis数据存储到session.dialogData
,然后调用ba.authenticate
,然后在最后一个瀑布步骤中同时使用这两个结果。