首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >botbuilder LuisRecognizer不能在proxy后面工作

botbuilder LuisRecognizer不能在proxy后面工作
EN

Stack Overflow用户
提问于 2017-08-02 19:48:19
回答 1查看 675关注 0票数 1

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

代码语言:javascript
复制
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".

代码语言:javascript
复制
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

代码语言:javascript
复制
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 Model url运行良好,返回正确的意图,并在浏览器中进行了测试。

如何调试?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-08-03 12:59:18

代码语言:javascript
复制
import globalTunnel from 'global-tunnel';

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

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

啊,真灵。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45460058

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档