From d20c2f774264cfcff3b986f8fca7c96274551885 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Tue, 19 Dec 2023 18:16:30 -0300 Subject: [PATCH] fix(basic.gblib): HEAR AS now shows domain items to user when validation fails. --- .../basic.gblib/services/DialogKeywords.ts | 2 +- packages/core.gbapp/services/GBMinService.ts | 33 ++++++++++++------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/packages/basic.gblib/services/DialogKeywords.ts b/packages/basic.gblib/services/DialogKeywords.ts index 9628fff9..3b353e15 100644 --- a/packages/basic.gblib/services/DialogKeywords.ts +++ b/packages/basic.gblib/services/DialogKeywords.ts @@ -1093,7 +1093,7 @@ export class DialogKeywords { }); if (result === null) { - await this.talk({ pid, text: `Escolha por favor um dos itens sugeridos.` }); + await this.talk({ pid, text: `Escolha por favor um dos itens sugeridos (${args.join(',')}).` }); return await this.hear({ pid, kind, args }); } } else if (kind === 'language') { diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index 9d8f159f..5837f183 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -1212,6 +1212,7 @@ export class GBMinService { } private async handleUploads(min, step, user, params, autoSave) { + // Prepare Promises to download each attachment and then execute each Promise. if ( @@ -1228,19 +1229,21 @@ export class GBMinService { // In case of not having HEAR activated before, it is // a upload with no Dialog, so run Auto Save to .gbdrive. + const t = new SystemKeywords(); + GBLog.info(`BASIC (${min.botId}): Upload done for ${attachmentData.fileName}.`); + const handle = WebAutomationServices.cyrb53(min.botId + attachmentData.fileName); + let data = Fs.readFileSync(attachmentData.localPath); + + const gbfile = { + filename: attachmentData.localPath, + data: data, + name: Path.basename(attachmentData.fileName) + }; + + GBServer.globals.files[handle] = gbfile; + if (!min.cbMap[user.userId] && autoSave) { - const t = new SystemKeywords(); - GBLog.info(`BASIC (${min.botId}): Upload done for ${attachmentData.fileName}.`); - const handle = WebAutomationServices.cyrb53(min.botId + attachmentData.fileName); - let data = Fs.readFileSync(attachmentData.localPath); - - const gbfile = { - filename: attachmentData.localPath, - data: data, - name: Path.basename(attachmentData.fileName) - }; - - GBServer.globals.files[handle] = gbfile; + const result = await t['internalAutoSave']({ min: min, handle: handle }); await min.conversationalService.sendText( min, @@ -1250,6 +1253,12 @@ export class GBMinService { return; } + else + { + return gbfile; + } + + } else { await this.sendActivity('Error uploading file. Please,start again.'); }