Skip to content

Commit

Permalink
fix(core.gbapp): Improvements in language selection and MSTEAMS integ…
Browse files Browse the repository at this point in the history
…ration.
  • Loading branch information
rodrigorodriguez committed Dec 10, 2020
1 parent 9488316 commit 23b89e5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/core.gbapp/dialogs/LanguageDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,24 @@ export class LanguageDialog extends IGBDialog {
{ name: 'english', code: 'en' },
{ name: 'inglês', code: 'en' },
{ name: 'portuguese', code: 'pt' },
{ name: 'português', code: 'pt' },
{ name: 'français', code: 'fr' },
{ name: 'francês', code: 'fr' },
{ name: 'french', code: 'fr' },
{ name: 'português', code: 'pt' },
{ name: 'spanish', code: 'es' },
{ name: 'espanõl', code: 'es' },
{ name: 'espanhol', code: 'es' },
{ name: 'german', code: 'de' },
{ name: 'deutsch', code: 'de' }
{ name: 'deutsch', code: 'de' },
{ name: 'alemão', code: 'de' }
];
let translatorLocale = null;
const text = step.context.activity['originalText'];

await CollectionUtil.asyncForEach(list, async item => {
if (GBConversationalService.kmpSearch(text, item.name) != -1) {
if (GBConversationalService.kmpSearch(text.toLowerCase(), item.name.toLowerCase()) != -1 ||
GBConversationalService.kmpSearch(text.toLowerCase(), item.code.toLowerCase()) != -1) {
translatorLocale = item.code;
}
});
Expand Down
9 changes: 9 additions & 0 deletions packages/core.gbapp/services/GBMinService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,11 @@ export class GBMinService {

private async processMessageActivity(context, min: GBMinInstance, step: GBDialogStep) {
const user = await min.userProfile.get(context, {});

// Removes <at>Bot Id</at> from MS Teams.

context.activity.text = context.activity.text.trim();
context.activity.text = context.activity.text.replace(/\<at\>.*\<\/at\>\s/gi, '')

let message: GuaribasConversationMessage;
if (process.env.PRIVACY_STORE_MESSAGES === 'true') {
Expand Down Expand Up @@ -769,6 +774,7 @@ export class GBMinService {
};

const isVMCall = Object.keys(min.scriptMap).find(key => min.scriptMap[key] === context.activity.text) !== undefined;


if (isVMCall) {
await GBVMService.callVM(context.activity.text, min, step, this.deployer);
Expand Down Expand Up @@ -908,6 +914,9 @@ export class GBMinService {

if (step.activeDialog !== undefined) {
await step.continueDialog();



} else {
// Checks if any .gbapp will handle this answer, if not goes to standard kb.gbapp.

Expand Down

0 comments on commit 23b89e5

Please sign in to comment.