Skip to content

Commit

Permalink
fix(kb.gbapp): NLP scoring added again.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paulo Henrique (pragmatismo.io) committed Jul 19, 2019
1 parent f36668e commit c83a5f9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/boot.gbot/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"enabledAdmin": "true",
"searchScore": ".15",
"nlpScore": ".15",
"nlpScore": ".40",
"nlpVsSearch": ".4"
}
12 changes: 11 additions & 1 deletion packages/core.gbapp/services/GBConversationalService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions packages/core.gbapp/services/GBCoreService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.');

Expand All @@ -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}`);
}
}

Expand Down

0 comments on commit c83a5f9

Please sign in to comment.