fix(all): Locale in Audio is dynamic.

This commit is contained in:
Rodrigo Rodriguez 2024-02-17 21:42:45 -03:00
parent e0980bc480
commit d1c4c23fa1
2 changed files with 3 additions and 6 deletions

View file

@ -542,7 +542,7 @@ export class GBConversationalService {
};
const languageCode = locale.substring(0, 2);
return locales[languageCode] || "Locale não encontrado";
return locales[languageCode] || "en-US_BroadbandModel";
};

View file

@ -186,7 +186,7 @@ export class WhatsappDirectLine extends GBService {
if (chat.isGroup) {
// await chat.clearMessages();
} else if (!chat.pinned) {
// await chat.delete();
await chat.delete();
}
});
});
@ -1033,10 +1033,8 @@ export class WhatsappDirectLine extends GBService {
p => p.instance.botId.toLowerCase() === text.toLowerCase()
)[0];
GBLog.info(`A WhatsApp mobile requested instance for: ${botId}.`);
let urlMin: any = GBServer.globals.minInstances.filter(p => p.instance.botId === botId)[0];
let user = await sec.getUserFromSystemId(id);
@ -1064,11 +1062,10 @@ export class WhatsappDirectLine extends GBService {
if (text != '' && detectLanguage) {
locale = await min.conversationalService.getLanguage(min, text);
GBLog.info(`${locale} defined for first time mobile: ${id}.`);
}
}
user = await sec.ensureUser(urlMin, id, '', '', 'omnichannel', '', '');
user = await sec.updateUserInstance(id, urlMin.instance.instanceId);
user = await sec.updateUserLocale(user.userId, locale);