fix(core.gbapp): Keep text fixed.
This commit is contained in:
parent
7f48c475f6
commit
50564c64d2
3 changed files with 36 additions and 16 deletions
|
@ -108,7 +108,7 @@ export class GBAdminService implements IGBAdminService {
|
||||||
lowerCaseAlpha: true,
|
lowerCaseAlpha: true,
|
||||||
number: true,
|
number: true,
|
||||||
specialCharacter: true,
|
specialCharacter: true,
|
||||||
minimumLength: 12,
|
minimumLength: 14,
|
||||||
maximumLength: 14
|
maximumLength: 14
|
||||||
};
|
};
|
||||||
let password = passwordGenerator.generatePassword(options);
|
let password = passwordGenerator.generatePassword(options);
|
||||||
|
@ -124,7 +124,21 @@ export class GBAdminService implements IGBAdminService {
|
||||||
lowerCaseAlpha: true,
|
lowerCaseAlpha: true,
|
||||||
number: false,
|
number: false,
|
||||||
specialCharacter: false,
|
specialCharacter: false,
|
||||||
minimumLength: 12,
|
minimumLength: 14,
|
||||||
|
maximumLength: 14
|
||||||
|
};
|
||||||
|
|
||||||
|
return passwordGenerator.generatePassword(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static getNumberIdentifier() {
|
||||||
|
const passwordGenerator = new PasswordGenerator();
|
||||||
|
const options = {
|
||||||
|
upperCaseAlpha: false,
|
||||||
|
lowerCaseAlpha: false,
|
||||||
|
number: true,
|
||||||
|
specialCharacter: false,
|
||||||
|
minimumLength: 14,
|
||||||
maximumLength: 14
|
maximumLength: 14
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -226,7 +240,7 @@ export class GBAdminService implements IGBAdminService {
|
||||||
return path.indexOf('sharepoint.com') > 0;
|
return path.indexOf('sharepoint.com') > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async publish(min: GBMinInstance, packageName: string, republish: boolean): Promise<void> {}
|
public async publish(min: GBMinInstance, packageName: string, republish: boolean): Promise<void> { }
|
||||||
public static async deployPackageCommand(min: GBMinInstance, text: string, deployer: IGBDeployer) {
|
public static async deployPackageCommand(min: GBMinInstance, text: string, deployer: IGBDeployer) {
|
||||||
const packageName = text.split(' ')[1];
|
const packageName = text.split(' ')[1];
|
||||||
|
|
||||||
|
|
|
@ -470,7 +470,7 @@ export class GBConversationalService {
|
||||||
|
|
||||||
text = text.toLowerCase().replace('who\'s', 'who is');
|
text = text.toLowerCase().replace('who\'s', 'who is');
|
||||||
text = text.toLowerCase().replace('what\'s', 'what is');
|
text = text.toLowerCase().replace('what\'s', 'what is');
|
||||||
|
|
||||||
const model = new LuisRecognizer({
|
const model = new LuisRecognizer({
|
||||||
applicationId: min.instance.nlpAppId,
|
applicationId: min.instance.nlpAppId,
|
||||||
endpointKey: min.instance.nlpKey,
|
endpointKey: min.instance.nlpKey,
|
||||||
|
@ -640,21 +640,26 @@ export class GBConversationalService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async sendText(min: GBMinInstance, step, text) {
|
public async sendText(min: GBMinInstance, step, text) {
|
||||||
|
await this['sendTextWithOptions'](min, step, text, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async sendTextWithOptions(min: GBMinInstance, step, text, translate) {
|
||||||
const member = step.context.activity.from;
|
const member = step.context.activity.from;
|
||||||
const user = await min.userProfile.get(step.context, {});
|
const user = await min.userProfile.get(step.context, {});
|
||||||
const systemUser = user.systemUser;
|
const systemUser = user.systemUser;
|
||||||
|
|
||||||
text = await min.conversationalService.translate(
|
if (translate) {
|
||||||
min,
|
text = await min.conversationalService.translate(
|
||||||
text,
|
min,
|
||||||
systemUser.locale
|
text,
|
||||||
? systemUser.locale
|
systemUser.locale
|
||||||
: min.core.getParam<string>(min.instance, 'Locale', GBConfigService.get('LOCALE'))
|
? systemUser.locale
|
||||||
);
|
: min.core.getParam<string>(min.instance, 'Locale', GBConfigService.get('LOCALE'))
|
||||||
GBLog.info(`Translated text(sendText): ${text}.`);
|
);
|
||||||
|
GBLog.info(`Translated text(sendText): ${text}.`);
|
||||||
|
}
|
||||||
|
|
||||||
const analytics = new AnalyticsService();
|
const analytics = new AnalyticsService();
|
||||||
|
|
||||||
analytics.createMessage(min.instance.instanceId, user.conversation, null, text);
|
analytics.createMessage(min.instance.instanceId, user.conversation, null, text);
|
||||||
|
|
||||||
if (!isNaN(member.id)) {
|
if (!isNaN(member.id)) {
|
||||||
|
|
|
@ -77,6 +77,7 @@ import { WhatsappDirectLine } from '../../whatsapp.gblib/services/WhatsappDirect
|
||||||
import fs = require('fs');
|
import fs = require('fs');
|
||||||
import { GuaribasConversationMessage } from '../../analytics.gblib/models';
|
import { GuaribasConversationMessage } from '../../analytics.gblib/models';
|
||||||
import { GBVMService } from './GBVMService';
|
import { GBVMService } from './GBVMService';
|
||||||
|
import { GBAdminService } from '../../admin.gbapp/services/GBAdminService';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minimal service layer for a bot.
|
* Minimal service layer for a bot.
|
||||||
|
@ -802,7 +803,7 @@ export class GBMinService {
|
||||||
);
|
);
|
||||||
|
|
||||||
let keepTextList = [];
|
let keepTextList = [];
|
||||||
|
const replacementToken = GBAdminService['getNumberIdentifier']();
|
||||||
if (keepTextList) {
|
if (keepTextList) {
|
||||||
keepTextList = keepTextList.concat(keepText.split(';'));
|
keepTextList = keepTextList.concat(keepText.split(';'));
|
||||||
}
|
}
|
||||||
|
@ -818,7 +819,7 @@ export class GBMinService {
|
||||||
let i = 0;
|
let i = 0;
|
||||||
await CollectionUtil.asyncForEach(keepTextList, item => {
|
await CollectionUtil.asyncForEach(keepTextList, item => {
|
||||||
i++;
|
i++;
|
||||||
text = text.replace(new RegExp(item.trim(), 'gi'), `KEEPTEXT${i}`);
|
text = text.replace(new RegExp(item.trim(), 'gi'), `${replacementToken}${i}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
text = await min.conversationalService.spellCheck(min, text);
|
text = await min.conversationalService.spellCheck(min, text);
|
||||||
|
@ -868,7 +869,7 @@ export class GBMinService {
|
||||||
let i = 0;
|
let i = 0;
|
||||||
await CollectionUtil.asyncForEach(keepTextList, item => {
|
await CollectionUtil.asyncForEach(keepTextList, item => {
|
||||||
i++;
|
i++;
|
||||||
text = text.replace(new RegExp(`\\bKEEPTEXT${i}\\b`, 'gi'), item.trim());
|
text = text.replace(new RegExp(`\\b${replacementToken}${i}\\b`, 'gi'), item.trim());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue