-
Notifications
You must be signed in to change notification settings - Fork 6
/
runLocal.js
40 lines (33 loc) · 1.01 KB
/
runLocal.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
© Copyright IBM Corp. 2017
*/
'use strict';
// Initialize handler
const {handler} = require('./');
const {logger} = require('./');
const manifest = require('./res/assets/manifest.json');
// Expertise configuration
require('dotenv').config();
const factory = require('./lib/nlu').factory;
//initialize wcs in handler
if(manifest.nlu.indexOf('wcs') > -1) {
handler.initialize();
}
//in case the nlu is handled in the skill - create nlu engines
let index = manifest.nlu.indexOf('skill');
let newManifest = JSON.parse(JSON.stringify(manifest));
newManifest.nlu.splice(index, 1);
if(index > -1) {
factory.getNLUs(newManifest).then(updatedManifest => {
if(updatedManifest.nlu.regexp) {
updatedManifest.intents = require('./res/nlu/intents');
}
handler.manifest = updatedManifest;
factory.createAll(updatedManifest).then(function (engines) {
handler.engines = engines;
});
});
}
logger.info("Logger Works");
// The expertise handler
require('./actions')();