diff --git a/packages/core.gbapp/services/GBConversationalService.ts b/packages/core.gbapp/services/GBConversationalService.ts index 2ef8e674..ceab62ec 100644 --- a/packages/core.gbapp/services/GBConversationalService.ts +++ b/packages/core.gbapp/services/GBConversationalService.ts @@ -992,9 +992,11 @@ export class GBConversationalService { GBLog.verbose(`Translated text(prompt): ${text}.`); } if (step.activeDialog.state.options['kind'] === 'file') { + return await step.prompt('attachmentPrompt', {}); } else { - return await step.prompt('textPrompt', text ? text : {}); + await this.sendText(min, step, text); + return await step.prompt('textPrompt', {}); } } diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index 7486b44f..20a6b6b6 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -831,10 +831,10 @@ export class GBMinService { adapter = min['fbAdapter']; } - // Unifies channel detection. + // Unifies channel detection. Unmarshalls group information. - req.body.channelId = - (req.body.from.channelIdEx === 'whatsapp' ? 'omnichannel' : req.body.channelId); + req.body.channelId = req.body.from.channelIdEx === 'whatsapp' ? 'omnichannel' : req.body.channelId; + req.body.group = req.body.from.group; // Default activity processing and handler. @@ -1322,11 +1322,8 @@ export class GBMinService { // If it is a group, spells and sends them back. const group = step.context.activity['group']; - if (textProcessed !== text && group){ - await min.whatsAppDirectLine.sendToDevice( - group, - `Spell: ${text}` - ); + if (textProcessed !== text && group) { + await min.whatsAppDirectLine.sendToDevice(group, `Spell: ${text}`); } // Detects user typed language and updates their locale profile if applies. diff --git a/packages/kb.gbapp/dialogs/AskDialog.ts b/packages/kb.gbapp/dialogs/AskDialog.ts index c2064f74..5ed1df23 100644 --- a/packages/kb.gbapp/dialogs/AskDialog.ts +++ b/packages/kb.gbapp/dialogs/AskDialog.ts @@ -97,12 +97,14 @@ export class AskDialog extends IGBDialog { user.subjects = []; } let text: string; + // Three forms of asking. + if (step.options && step.options.firstTime) { text = Messages[locale].ask_first_time; - } else if (step.options && step.options.isReturning) { + } else if (step.options && step.options.isReturning && !step.context.activity.group) { text = Messages[locale].anything_else; - } else if (step.options && step.options.emptyPrompt) { + } else if (step.context.activity.group || (step.options && step.options.emptyPrompt)) { text = ''; } else if (user.subjects.length > 0) { text = Messages[locale].which_question; @@ -302,8 +304,7 @@ export class AskDialog extends IGBDialog { } const CHATGPT_TIMEOUT = 60 * 1000; GBLog.info(`ChatGPT being used...`); - const response = await GBServer.globals.chatGPT.sendMessage(text, - { timeoutMs: CHATGPT_TIMEOUT }); + const response = await GBServer.globals.chatGPT.sendMessage(text, { timeoutMs: CHATGPT_TIMEOUT }); if (!response) { GBLog.info(`SEARCH called but NO answer could be found (zero results).`); diff --git a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts index 035346fe..24e978e3 100644 --- a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts +++ b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts @@ -618,7 +618,8 @@ export class WhatsappDirectLine extends GBService { from: { id: from, channelIdEx: 'whatsapp', - name: fromName + name: fromName, + group: group }, replyToId: from }