botbuilder LuisRecognizer 不在代理后面工作

botbuilder LuisRecognizer not working behind proxy

我写了一个自定义识别器。

bot.recognizer({
  recognize: function (context, done) {
  var intent = { score: 1.0, intent: 'Greetings'};
      if (context.message.text.toLowerCase() == 'hello' ) {
        done(null, intent);
       }
    }
});

var bot = new builder.UniversalBot(connector, (session)  => {
    session.send("Sorry couldn't understand");
});

// here is the dialog
bot.dialog('Greetings', [(session, args, next) => {
    sesson.send("hey there");
}]).triggerAction({
    matches: 'Greetings',
    onInterrupted: function (session) {
        session.send('hey there');
    }
});

当我在模拟器中输入 "Hello" 时,它会回复 hey there。有用。

但是当我尝试使用 Luis API 时它不起作用。它回复 "Sorry couldn't understand".

const model = "https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/**?subscription-key=***&verbose=true";
var recognizer = new builder.LuisRecognizer(model);
bot.recognizer(recognizer) 

我在终端 (node>) 中尝试了以下操作,但它不起作用。 here is the doc I followed

var builder = require('botbuilder');
var model = "https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/***?subscription-key=***&verbose=true&timezoneOffset=330&spellCheck=false";
var recognizer = new builder.LuisRecognizer(model);
recognizer.recognize(
  "hello",
   model,
  function (err, intents, entities) {
    console.log(intents);
  }
)

Luis 模型 url 工作得很好,returns 正确的意图,在浏览器中测试了它。

如何调试?

import globalTunnel from 'global-tunnel';

process.env.http_proxy = 'http://proxy:80';
process.env.https_proxy = 'http://proxy:80';
globalTunnel.initialize();

添加识别器后添加globalTunnel.end()bot.recognizer(recognizer)

成功了。