Skip to content

Commit

Permalink
fix(basic.gblib): Step added to SendFileTo.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Mar 8, 2021
1 parent f40eae7 commit 85e9602
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 105 deletions.
20 changes: 16 additions & 4 deletions packages/core.gbapp/services/GBMinService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ export class GBMinService {
await min.userProfile.set(step.context, user);
}

user.systemUser = await sec.getUserFromSystemId( user.systemUser.userSystemId);
user.systemUser = await sec.getUserFromSystemId(user.systemUser.userSystemId);
await min.userProfile.set(step.context, user);

// Required for MSTEAMS handling of persisted conversations.
Expand Down Expand Up @@ -1062,7 +1062,7 @@ export class GBMinService {
if (detectLanguage || !locale) {
locale = await min.conversationalService.getLanguage(min, text);
if (systemUser.locale != locale) {

user.systemUser = await sec.updateUserLocale(systemUser.userId, locale);
await min.userProfile.set(step.context, user);
}
Expand Down Expand Up @@ -1099,13 +1099,25 @@ export class GBMinService {
context.activity.originalText = originalText;
GBLog.info(`Final text ready for NLP/Search/.gbapp: ${text}.`);


if (user.systemUser.agentMode === 'self') {
const manualUser = await sec.getUserFromAgentSystemId(user.systemUser.userSystemId);

GBLog.info(`HUMAN AGENT (${user.systemUser.userSystemId}) TO USER ${manualUser.userSystemId}: ${text}`);
await min.whatsAppDirectLine.sendToDeviceEx(manualUser.userSystemId, `${manualUser.agentSystemId}: ${text}`, locale);

const cmd = 'SEND FILE ';
if (text.startsWith(cmd)) {
const filename = text.substr(cmd.length);
const message = await min.kbService.getAnswerTextByMediaName(min.instance.instanceId, filename);

if (message === null) {
GBLog.error(`File ${filename} not found in any .gbkb published. Check the name or publish again the associated .gbkb.`);
} else {
await min.conversationalService.sendMarkdownToMobile(min, null, manualUser.userSystemId, message);
}
}
else {
await min.whatsAppDirectLine.sendToDeviceEx(manualUser.userSystemId, `${manualUser.agentSystemId}: ${text}`, locale);
}
}
else {

Expand Down
99 changes: 0 additions & 99 deletions packages/default.gbui/npm-check.report

This file was deleted.

4 changes: 2 additions & 2 deletions packages/whatsapp.gblib/services/WhatsappDirectLine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ export class WhatsappDirectLine extends GBService {
await sec.updateHumanAgent(manualUser.userSystemId, this.min.instance.instanceId, null);
await sec.updateHumanAgent(user.agentSystemId, this.min.instance.instanceId, null);
} else {
GBLog.info(`HUMAN AGENT (${id}) TO USER ${manualUser.userSystemId}: ${text}`);
await this.sendToDeviceEx(manualUser.userSystemId, `${manualUser.agentSystemId}: ${text}`, locale);
GBLog.info(`HUMAN AGENT (${manualUser.agentSystemId}) TO USER ${manualUser.userSystemId}: ${text}`);
await this.sendToDeviceEx(manualUser.userSystemId, `AGENTE: *${text}*`, locale);
}
}

Expand Down

0 comments on commit 85e9602

Please sign in to comment.