机器人无法识别 LUIS Intent

LUIS Intent not recognized by bot

编辑

很抱歉大家,这只是由于意图名称后缺少逗号。我很抱歉 x:


我最近正在使用 Microsoft Bot Framework (botbuilder v3.14.0)、Node.js (v8.9.4) 和 LUIS 创建一个聊天机器人。

我能够成功 'recognize' 机器人中的一些意图,并且 return 想要的结果,但是对于某些意图,机器人似乎无法获取意图,即使 LUIS 的结果指向正确的结果。

我尝试使用 LUIS 测试 blade 进行测试,并在 chrome 中的端点 URL 之后直接输入查询。这两种方法都会 return 我的意图相同且正确。端点 URL 方法的示例结果如下:

{
  "query": "why do you exist",
  "topScoringIntent": {
    "intent": "bot-existence",
    "score": 0.597947
  },
  "intents": [
    {
      "intent": "bot-existence",
      "score": 0.597947
    },
    {
      "intent": "bot-joke",
      "score": 0.04189388
    },
    {
      "intent": "Exit",
      "score": 0.0182088781
    },
    {
      "intent": "None",
      "score": 0.0164906159
    },
    {
      "intent": "Cancel",
      "score": 0.009767669
    },
    {
      "intent": "Stop",
      "score": 0.009608646
    },
    {
      "intent": "bot-age",
      "score": 0.009238302
    },
    {
      "intent": "Greeting",
      "score": 0.008374314
    },
    {
      "intent": "bot-name",
      "score": 0.00683666952
    },
    {
      "intent": "Help",
      "score": 0.00357789616
    },
    {
      "intent": "StartOver",
      "score": 0.00262053218
    },
    {
      "intent": "checkDBStatus",
      "score": 0.002412489
    },
    {
      "intent": "refreshSchema",
      "score": 1.35339326E-06
    },
    {
      "intent": "checkDutyPerson",
      "score": 5.41015623E-08
    }
  ],
  "entities": []
}

在这种情况下,机器人应该能够识别出 bot-existence 意图并执行此代码:

intents.matches('bot-existence' [
    function (session) {
        console.log('bot-existence Intent');

        session.beginDialog('bot-existDialog');
    }
]);

但事实并非如此。它适用于其他意图,例如 bot-agebot-jokecheckDBStatus。这些意图的代码与上面 bot-existence 的代码相同,只是进行了编辑以适当地适应意图。我也多次发布了 LUIS 应用程序,以防万一,但无济于事。

知道为什么吗?

尝试这种方式,使用 triggerAction:

var recognizer = new builder.LuisRecognizer(LuisModelUrl);
// Add the recognizer to the bot
bot.recognizer(recognizer);

bot.dialog('bot-existence', [

  function (session, args) {
        console.log('bot-existence Intent');
        session.beginDialog('bot-existDialog');
    }      
]).triggerAction({matches:'bot-existence'});

抱歉,伙计们,我只缺少代码中的一个逗号,就在意图名称旁边 ('bot-existence')。编辑后的代码段如下!

intents.matches('bot-existence', [
    function (session) {
        console.log('bot-existence Intent');

        session.beginDialog('bot-existDialog');
    }
]);