From 3d42ab91bb7042dda1e43bc18657f93f5af746ee Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Sun, 23 May 2021 16:42:54 -0300 Subject: [PATCH] fix(core.gbapp): Logging about auto start. --- packages/core.gbapp/services/GBMinService.ts | 6 +++--- packages/kb.gbapp/dialogs/AskDialog.ts | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index 8656017d..796fd99f 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -313,7 +313,7 @@ export class GBMinService { user.hearOnDialog : activeMin.core.getParam(activeMin.instance, 'Start Dialog', null); - GBLog.info(`Auto start dialog is now being called: ${startDialog}...`); + GBLog.info(`Auto start (1) dialog is now being called: ${startDialog} for ${activeMin.instance.instanceId}...`); if (startDialog) { req.body.messages[0].body = `/call ${startDialog}`; @@ -342,7 +342,7 @@ export class GBMinService { await sec.updateUserInstance(id, instance.instanceId); await (activeMin as any).whatsAppDirectLine.resetConversationId(id); const startDialog = activeMin.core.getParam(activeMin.instance, 'Start Dialog', null); - GBLog.info(`Auto start dialog is now being called: ${startDialog}...`); + GBLog.info(`Auto start (2) dialog is now being called: ${startDialog} for ${activeMin.instance.instanceId}...`); if (startDialog) { req.body.messages[0].body = `/call ${startDialog}`; @@ -840,7 +840,7 @@ export class GBMinService { const startDialog = min.core.getParam(min.instance, 'Start Dialog', null); if (startDialog && !user.welcomed) { user.welcomed = true; - GBLog.info(`Auto start dialog is now being called: ${startDialog}...`); + GBLog.info(`Auto start (3) dialog is now being called: ${startDialog} for ${min.instance.instanceId}...`); await GBVMService.callVM(startDialog.toLowerCase(), min, step, this.deployer); } else { diff --git a/packages/kb.gbapp/dialogs/AskDialog.ts b/packages/kb.gbapp/dialogs/AskDialog.ts index 1f27ef3b..203286e8 100644 --- a/packages/kb.gbapp/dialogs/AskDialog.ts +++ b/packages/kb.gbapp/dialogs/AskDialog.ts @@ -84,11 +84,11 @@ export class AskDialog extends IGBDialog { if (step.context.activity.channelId !== 'msteams' && process.env.ENABLE_AUTH) { return await step.beginDialog('/auth'); } - else{ + else { return await step.next(step.options); } }, - async step => { + async step => { const locale = step.context.activity.locale; const user = await min.userProfile.get(step.context, {}); user.isAsking = true; @@ -108,9 +108,9 @@ export class AskDialog extends IGBDialog { } else { throw new Error('Invalid use of /ask'); } - + return await min.conversationalService.prompt(min, step, text); - + }, async step => { if (step.result) { @@ -155,11 +155,11 @@ export class AskDialog extends IGBDialog { if (step.context.activity.channelId !== 'msteams' && process.env.ENABLE_AUTH) { return await step.beginDialog('/auth'); } - else{ + else { return await step.next(step.options); } }, - async step => { + async step => { let answer: GuaribasAnswer = null; const user = await min.userProfile.get(step.context, {}); @@ -174,7 +174,9 @@ export class AskDialog extends IGBDialog { if (!text) { const startDialog = min.core.getParam(min.instance, 'Start Dialog', null); - await GBVMService.callVM(startDialog.toLowerCase(), min, step, this.deployer); + if (startDialog) { + await GBVMService.callVM(startDialog.toLowerCase().trim(), min, step, this.deployer); + } return step.endDialog(); } @@ -278,7 +280,7 @@ export class AskDialog extends IGBDialog { if (step.context.activity.channelId !== 'msteams' && process.env.ENABLE_AUTH) { return await step.beginDialog('/auth'); } - else{ + else { return await step.next(step.options); } },