LUIS,从机器人获取用户响应

时间:2018-11-12 12:16:40

标签: node.js nlp botframework luis

我已经构建了与LUIS集成的机器人,名称为“ Order”的意图已被捕获,对话成功触发。我想知道如何捕获用户的输入。 我不允许使用提示,因为正在进行意图识别,然后相应地启动了对话。

希望能帮助我捕获用户输入。

示例”用户说:寻找我上次订单的状态。

订购意向。

匹配80%------->订单对话开始。

var builder = require('botbuilder');
module.exports = function(bot) {
    // Make sure you add code to validate these fields
    var luisAppId = process.env.LuisAppId;
    var luisAPIKey = process.env.LuisAPIKey;
    var luisAPIHostName = process.env.LuisAPIHostName || 'westus.api.cognitive.microsoft.com';

    const LuisModelUrl = 'https://' + luisAPIHostName + '/luis/v2.0/apps/' + luisAppId + '?subscription-key=' + luisAPIKey;

    // Create a recognizer that gets intents from LUIS, and add it to the bot
    var recognizer = new builder.LuisRecognizer(LuisModelUrl);
    bot.recognizer(recognizer);

    // Add a dialog for each intent that the LUIS app recognizes.
    // See https://docs.microsoft.com/en-us/bot-framework/nodejs/bot-builder-nodejs-recognize-intent-luis 

    bot.dialog('OrderDialog',
    function (session) {
        session.send("this is order LUIS segment, try to fetch User input " 
        }
    ).triggerAction({
        matches: 'Order'
    })
}

1 个答案:

答案 0 :(得分:0)

bot.dialog('OrderDialog',
    function (session) {
        console.log("session value capturing==============>",session.message.text);
        }
        );