forked from Watson-Personal-Assistant/SkillBoilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·41 lines (34 loc) · 1.09 KB
/
index.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
41
/*
© Copyright IBM Corp. 2017
*/
'use strict';
// Initialize handler
const {handler} = require('skill-sdk-nodejs');
const manifest = require('./res/assets/manifest.json');
const factory = require('skill-sdk-nodejs').factory;
// Expertise configuration
require('dotenv').config();
//initialize wcs in handler
if(manifest.nlu.indexOf('wcs') > -1) {
handler.initialize();
}
let localManifest = JSON.parse(JSON.stringify(manifest));
let index = localManifest.nlu.indexOf('skill');
if(index !== -1) {
localManifest.nlu.splice(index, 1);
}
if (localManifest.nlu.length < 1) {
console.error('No Nlu engines selected, you need to add the nlu engines you want to use to manifest.json nlu field')
} else {
factory.getNLUs(localManifest).then(updatedManifest => {
if (updatedManifest.nlu.regexp) {
updatedManifest.intents = require('./res/nlu/intents');
}
handler.manifest = updatedManifest;
factory.createAll(updatedManifest).then(function (engines) {
handler.engines = engines;
});
});
}
// The expertise handler
require('./actions')();