# Conflicts:
#	packages/core.gbapp/services/GBMinService.ts
This commit is contained in:
Rodrigo Rodriguez 2020-05-17 21:36:30 +00:00
commit 8cb0fdb8b2
2 changed files with 30 additions and 30 deletions

View file

@ -217,17 +217,11 @@ export class AskDialog extends IGBDialog {
private static async handleAnswer(service: KBService, min: GBMinInstance, step: any, answer: GuaribasAnswer) {
const dialogSufix = 'dialog:';
const urlSufix = 'url:';
const scriptSufix = 'script:';
if (answer.content.startsWith(dialogSufix)) {
let dialogName = answer.content.substring(dialogSufix.length);
return await step.replaceDialog(`/${dialogName}`, { isReturning: true });
} else if (answer.content.startsWith(scriptSufix)) {
let scriptName = answer.content.substring(scriptSufix.length);
return await GBMinService.callVM(scriptName, min, step);
if (answer.content.endsWith('.docx')) {
const mainName = answer.content.replace(/\s|\-/g, '').split('.')[0];
return await GBMinService.callVM(mainName, min, step);
} else {
await service.sendAnswer(min, AskDialog.getChannel(step), step, answer);

View file

@ -195,6 +195,11 @@ export class WhatsappDirectLine extends GBService {
if (user.agentMode === "self") {
let manualUser = await sec.getUserFromAgentSystemId(id);
if (manualUser === null) {
await sec.updateCurrentAgent(id, this.min.instance.instanceId, null);
}
else {
const cmd = '/reply ';
if (text.startsWith(cmd)) {
let filename = text.substr(cmd.length);
@ -214,7 +219,8 @@ export class WhatsappDirectLine extends GBService {
}
else {
GBLog.info(`HUMAN AGENT (${id}) TO USER ${manualUser.userSystemId}: ${text}`);
this.sendToDevice(manualUser.userSystemId, `${manualUser.userSystemId}: ${text}`);
this.sendToDevice(manualUser.userSystemId, `${manualUser.agentSystemId}: ${text}`);
}
}
}
else if (user.agentMode === "human") {
@ -222,7 +228,7 @@ export class WhatsappDirectLine extends GBService {
if (text === '/t') {
await this.sendToDevice(user.userSystemId, `Você já está sendo atendido por ${agent.userSystemId}.`);
}
else if (text === '/qt') {
else if (text === '/qt' || text === "Sair" || text === "Fechar" ) {
// TODO: Transfers only in pt-br for now.
await this.sendToDevice(id, Messages[this.locale].notify_end_transfer(this.min.instance.botId));
await this.sendToDevice(user.agentSystemId, Messages[this.locale].notify_end_transfer(this.min.instance.botId));
@ -230,7 +236,7 @@ export class WhatsappDirectLine extends GBService {
await sec.updateCurrentAgent(id, this.min.instance.instanceId, null);
}
else {
GBLog.info(`USER (${id}) TO AGENT ${agent.userSystemId}: ${text}`);
GBLog.info(`USER (${id}) TO AGENT ${user.userSystemId}: ${text}`);
this.sendToDevice(user.agentSystemId, `${id}: ${text}`);
}