fix(core.gbapp): Fix in deployer.
This commit is contained in:
parent
e32b9a2e76
commit
ec40fd8b62
2 changed files with 18 additions and 7 deletions
|
@ -349,7 +349,7 @@ export class GBDeployer implements IGBDeployer {
|
|||
await this.core.deleteInstance(botId);
|
||||
}
|
||||
public async deployPackageToStorage(instanceId: number, packageName: string): Promise<GuaribasPackage> {
|
||||
return GuaribasPackage.create({
|
||||
return await GuaribasPackage.create({
|
||||
packageName: packageName,
|
||||
instanceId: instanceId
|
||||
});
|
||||
|
@ -389,7 +389,12 @@ export class GBDeployer implements IGBDeployer {
|
|||
},
|
||||
updatePackage: async (p: GuaribasPackage) => {
|
||||
p.save();
|
||||
},
|
||||
existsPackage: async (packageName: string) => {
|
||||
return await _this.getStoragePackageByName(min.instance.instanceId, packageName);
|
||||
}
|
||||
|
||||
|
||||
}))
|
||||
) {
|
||||
handled = true;
|
||||
|
|
|
@ -803,11 +803,13 @@ export class GBMinService {
|
|||
);
|
||||
|
||||
let keepTextList = [];
|
||||
const replacementToken = GBAdminService['getNumberIdentifier']();
|
||||
|
||||
if (keepTextList) {
|
||||
keepTextList = keepTextList.concat(keepText.split(';'));
|
||||
}
|
||||
|
||||
let replacements = [];
|
||||
|
||||
await CollectionUtil.asyncForEach(min.appPackages, async (e: IGBPackage) => {
|
||||
const result = await e.onExchangeData(min, 'getKeepText', {});
|
||||
if (result) {
|
||||
|
@ -818,8 +820,12 @@ export class GBMinService {
|
|||
if (keepTextList) {
|
||||
let i = 0;
|
||||
await CollectionUtil.asyncForEach(keepTextList, item => {
|
||||
if (text.indexOf(item) != -1) {
|
||||
const replacementToken = GBAdminService['getNumberIdentifier']();
|
||||
replacements[i] = { text: item, replacementToken: replacementToken };
|
||||
i++;
|
||||
text = text.replace(new RegExp(item.trim(), 'gi'), `${replacementToken}${i}`);
|
||||
text = text.replace(new RegExp(item.trim(), 'gi'), `${replacementToken}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
text = await min.conversationalService.spellCheck(min, text);
|
||||
|
@ -867,9 +873,9 @@ export class GBMinService {
|
|||
|
||||
if (keepTextList) {
|
||||
let i = 0;
|
||||
await CollectionUtil.asyncForEach(keepTextList, item => {
|
||||
await CollectionUtil.asyncForEach(replacements, item => {
|
||||
i++;
|
||||
text = text.replace(new RegExp(`\\b${replacementToken}${i}\\b`, 'gi'), item.trim());
|
||||
text = text.replace(new RegExp(`${item.replacementToken}`, 'gi'), item.text);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue