new(core.gbapp): Entity extraction tested and startu optmizations.
This commit is contained in:
parent
0aca3853d6
commit
62ef6e5416
4 changed files with 14 additions and 59 deletions
|
@ -508,18 +508,14 @@ export class GBConversationalService {
|
|||
const topIntent = LuisRecognizer.topIntent(nlp);
|
||||
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;
|
||||
// tslint:ensable:no-unsafe-any
|
||||
|
||||
if (intent === 'None') {
|
||||
return false;
|
||||
}
|
||||
|
||||
GBLog.info(`NLP called: ${intent} ${firstEntity}`);
|
||||
GBLog.info(`NLP called: ${intent}, entities: ${nlp.entities}`);
|
||||
|
||||
try {
|
||||
step.activeDialog.state.otptions.entities = nlp.entities;
|
||||
step.activeDialog.state.options.entities = nlp.entities;
|
||||
await step.replaceDialog(`/${intent}`, step.activeDialog.state.options);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -98,7 +98,9 @@ export class GBCoreService implements IGBCoreService {
|
|||
constructor() {
|
||||
this.adminService = new GBAdminService(this);
|
||||
}
|
||||
public async ensureInstances(instances: IGBInstance[], bootInstance: any, core: IGBCoreService) {
|
||||
|
||||
}
|
||||
/**
|
||||
* Gets database config and connect to storage.
|
||||
*/
|
||||
|
@ -405,23 +407,6 @@ STORAGE_SYNC=true
|
|||
return instances;
|
||||
}
|
||||
|
||||
/**
|
||||
* If instances is undefined here it's because storage has been formatted.
|
||||
* Load all instances from .gbot found on deploy package directory.
|
||||
* @param instances
|
||||
* @param bootInstance
|
||||
* @param core
|
||||
*/
|
||||
public async ensureInstances(instances: IGBInstance[], bootInstance: any, core: IGBCoreService) {
|
||||
if (instances === undefined) {
|
||||
const instance = new GuaribasInstance();
|
||||
await instance.save();
|
||||
instances = await core.loadInstances();
|
||||
}
|
||||
|
||||
return instances;
|
||||
}
|
||||
|
||||
public async loadSysPackages(core: GBCoreService): Promise<IGBPackage[]> {
|
||||
// NOTE: if there is any code before this line a semicolon
|
||||
// will be necessary before this line.
|
||||
|
|
|
@ -571,16 +571,6 @@ export class GBDeployer implements IGBDeployer {
|
|||
throw e;
|
||||
}
|
||||
|
||||
// Deploys all .gbot files first.
|
||||
|
||||
await CollectionUtil.asyncForEach(botPackages, async e => {
|
||||
if (e !== 'packages\\boot.gbot') {
|
||||
GBLog.info(`Deploying bot: ${e}...`);
|
||||
await _this.deployBotFromLocalPath(e, GBServer.globals.publicAddress);
|
||||
GBLog.info(`√ Bot: ${e} deployed...`);
|
||||
}
|
||||
});
|
||||
|
||||
// Then all remaining generalPackages are loaded.
|
||||
|
||||
const instances = core.loadInstances();
|
||||
|
|
28
src/app.ts
28
src/app.ts
|
@ -66,14 +66,12 @@ export class RootData {
|
|||
public minBoot: GBMinInstance;
|
||||
public wwwroot: string; // .gbui or a static webapp.
|
||||
public entryPointDialog: string; // To replace default welcome dialog.
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* General Bots open-core entry point.
|
||||
*/
|
||||
export class GBServer {
|
||||
|
||||
public static globals: RootData;
|
||||
|
||||
/**
|
||||
|
@ -81,7 +79,6 @@ export class GBServer {
|
|||
*/
|
||||
|
||||
public static run() {
|
||||
|
||||
GBLog.info(`The Bot Server is in STARTING mode...`);
|
||||
GBServer.globals = new RootData();
|
||||
GBConfigService.init();
|
||||
|
@ -117,7 +114,6 @@ export class GBServer {
|
|||
const azureDeployer: AzureDeployerService = new AzureDeployerService(deployer);
|
||||
const adminService: GBAdminService = new GBAdminService(core);
|
||||
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
const proxy = GBConfigService.get('REVERSE_PROXY');
|
||||
if (proxy !== undefined) {
|
||||
|
@ -141,7 +137,7 @@ export class GBServer {
|
|||
await core.initStorage();
|
||||
} catch (error) {
|
||||
GBLog.verbose(`Error initializing storage: ${error}`);
|
||||
GBServer.globals.bootInstance = await core.createBootInstance(core, azureDeployer, GBServer.globals.publicAddress);
|
||||
await core.createBootInstance(core, azureDeployer, GBServer.globals.publicAddress);
|
||||
await core.initStorage();
|
||||
}
|
||||
|
||||
|
@ -156,24 +152,12 @@ export class GBServer {
|
|||
|
||||
// Loads boot bot and other instances.
|
||||
|
||||
GBLog.info(`Publishing instances...`);
|
||||
const packageInstance = await importer.importIfNotExistsBotPackage(
|
||||
GBConfigService.get('BOT_ID'),
|
||||
'boot.gbot',
|
||||
'packages/boot.gbot'
|
||||
let instances: IGBInstance[] = await core.loadAllInstances(
|
||||
core,
|
||||
azureDeployer,
|
||||
GBServer.globals.publicAddress
|
||||
);
|
||||
if (GBServer.globals.bootInstance === undefined) {
|
||||
GBServer.globals.bootInstance = packageInstance;
|
||||
}
|
||||
// tslint:disable-next-line:prefer-object-spread
|
||||
const fullInstance = Object.assign(packageInstance, GBServer.globals.bootInstance);
|
||||
await core.saveInstance(fullInstance);
|
||||
let instances: IGBInstance[] = await core.loadAllInstances(core, azureDeployer,
|
||||
GBServer.globals.publicAddress);
|
||||
instances = await core.ensureInstances(instances, GBServer.globals.bootInstance, core);
|
||||
if (GBServer.globals.bootInstance !== undefined) {
|
||||
GBServer.globals.bootInstance = instances[0];
|
||||
}
|
||||
|
||||
// Builds minimal service infrastructure.
|
||||
|
||||
|
@ -184,7 +168,7 @@ export class GBServer {
|
|||
|
||||
// Deployment of local applications for the first time.
|
||||
|
||||
if (GBConfigService.get("DISABLE_WEB") !== "true") {
|
||||
if (GBConfigService.get('DISABLE_WEB') !== 'true') {
|
||||
deployer.setupDefaultGBUI();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue