fix(kb.gbapp): NLP scoring added again.
This commit is contained in:
parent
f36668ed0f
commit
c83a5f9e03
3 changed files with 15 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"enabledAdmin": "true",
|
"enabledAdmin": "true",
|
||||||
"searchScore": ".15",
|
"searchScore": ".15",
|
||||||
"nlpScore": ".15",
|
"nlpScore": ".40",
|
||||||
"nlpVsSearch": ".4"
|
"nlpVsSearch": ".4"
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,10 +122,20 @@ export class GBConversationalService implements IGBConversationalService {
|
||||||
// tslint:enable:no-unsafe-any
|
// 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.
|
// Resolves intents returned from LUIS.
|
||||||
|
|
||||||
const topIntent = LuisRecognizer.topIntent(nlp);
|
const topIntent = LuisRecognizer.topIntent(nlp);
|
||||||
if (topIntent !== undefined) {
|
if (topIntent !== undefined && nlpActive) {
|
||||||
|
|
||||||
const intent = topIntent;
|
const intent = topIntent;
|
||||||
// tslint:disable:no-unsafe-any
|
// tslint:disable:no-unsafe-any
|
||||||
const firstEntity = nlp.entities && nlp.entities.length > 0 ? nlp.entities[0].entity.toUpperCase() : undefined;
|
const firstEntity = nlp.entities && nlp.entities.length > 0 ? nlp.entities[0].entity.toUpperCase() : undefined;
|
||||||
|
|
|
@ -248,7 +248,7 @@ STORAGE_SYNC=true
|
||||||
fs.existsSync('node_modules/ngrok/bin/ngrok')) {
|
fs.existsSync('node_modules/ngrok/bin/ngrok')) {
|
||||||
const ngrok = require('ngrok');
|
const ngrok = require('ngrok');
|
||||||
|
|
||||||
return await ngrok.connect({ port: port });
|
return await ngrok.connectRetry({ port: port }, 10);
|
||||||
} else {
|
} else {
|
||||||
GBLog.warn('ngrok executable not found (only tested on Windows). Check installation or node_modules folder.');
|
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) {
|
} catch (error) {
|
||||||
// There are false positive from ngrok regarding to no memory, but it's just
|
// There are false positive from ngrok regarding to no memory, but it's just
|
||||||
// lack of connection.
|
// 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}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue