fix(kb.gbapp): NLP scoring added again.

This commit is contained in:
Paulo Henrique (pragmatismo.io) 2019-07-19 13:35:11 -03:00
parent f36668ed0f
commit c83a5f9e03
3 changed files with 15 additions and 5 deletions

View file

@ -1,6 +1,6 @@
{
"enabledAdmin": "true",
"searchScore": ".15",
"nlpScore": ".15",
"nlpScore": ".40",
"nlpVsSearch": ".4"
}

View file

@ -122,10 +122,20 @@ export class GBConversationalService implements IGBConversationalService {
// tslint:enable:no-unsafe-any
}
let nlpActive = false;
Object.keys(nlp.intents).forEach((name) => {
const score = nlp.intents[name].score;
if (score > min.instance.nlpScore){
nlpActive = true;
}
});
// Resolves intents returned from LUIS.
const topIntent = LuisRecognizer.topIntent(nlp);
if (topIntent !== undefined) {
if (topIntent !== undefined && nlpActive) {
const intent = topIntent;
// tslint:disable:no-unsafe-any
const firstEntity = nlp.entities && nlp.entities.length > 0 ? nlp.entities[0].entity.toUpperCase() : undefined;

View file

@ -248,7 +248,7 @@ STORAGE_SYNC=true
fs.existsSync('node_modules/ngrok/bin/ngrok')) {
const ngrok = require('ngrok');
return await ngrok.connect({ port: port });
return await ngrok.connectRetry({ port: port }, 10);
} else {
GBLog.warn('ngrok executable not found (only tested on Windows). Check installation or node_modules folder.');
@ -257,8 +257,8 @@ STORAGE_SYNC=true
} catch (error) {
// There are false positive from ngrok regarding to no memory, but it's just
// lack of connection.
GBLog.verbose(error);
throw new Error('Error connecting to remote ngrok server, please check network connection.');
throw new Error(`Error connecting to remote ngrok server, please check network connection. ${error.msg}`);
}
}