【发布时间】:2017-09-06 07:39:37
【问题描述】:
在假期周末,我一直在尝试让机器人使用 Microsoft Bot Framework 工作。我正在为 Node.js 使用 botbuilder 包的 3.9.1 版。
我在 www.luis.ai 创建了一个应用程序和模型。我已经能够通过“训练和测试”功能成功测试我的意图。然后,在我的实际 Node 代码中,我有以下内容:
let connector = new BotBuilder.ChatConnector({
appId: 'myId',
appPassword: 'myAppSecret'
});
let bot = new BotBuilder.UniversalBot(connector);
let luis = new BotBuilder.LuisRecognizer('myLuisAppUrl');
let intent = new BotBuilder.IntentDialog({ });
intent.recognizer(luis);
intent.matches('Intent.1', '/execute-report');
intent.matches('Intent.2', '/execute-batch-job');
intent.onDefault('/unknown');
bot.dialog('/', intent);
bot.dialog('/execute-report', [function(session, args, next) {
var result = ((Date.now() % 2) === 0) ? 'Report Ran!' : 'Failed';
session.send(result);
}]);
bot.dialog('/execute-batch-job', [function(session, args, next) {
var result = ((Date.now() % 2) === 0) ? 'Batch Job Ran!' : 'Unable to run Batch Job';
session.send(result);
}]);
bot.dialog('/unknown', [function(session, args, next) {
session.send('What did you ask for?');
}]);
与我的机器人交互时,我总是得到“你要求什么?”。换句话说,在这一点上,我知道:
- 我可以成功地与我的机器人交互。但是,
/unknown对话框总是被调用,这不是正确的交互方式。 -
我在 LUIS 中的模型看起来正确:
一个。如果我在 LUIS.ai 测试应用中输入“运行报告”,得分最高的意图是“Intent.1”
b.如果我在 LUIS.ai 测试应用中输入“执行批处理作业”,得分最高的意图是“Intent.2”
但是,我的机器人没有发送适当的响应。 /execute-report 和 /execute-batch-job 对话框从不使用,即使它们应该使用。我不明白我做错了什么。对我来说,我相信我已经正确设置了我的机器人。我看不出我做错了什么。有人可以告诉我我做错了什么吗?有没有办法在我的节点代码中查看从 LUIS 返回的响应,类似于在 LUIS.ai 的“测试”应用中看到的响应
【问题讨论】:
标签: node.js botframework azure-language-understanding