我写了一个自定义的识别器。
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 Model url运行良好,返回正确的意图,并在浏览器中进行了测试。
如何调试?
发布于 2017-08-03 12:59:18
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()
啊,真灵。
https://stackoverflow.com/questions/45460058
复制相似问题