new(admin.gbapp): Publish command will publish every package type.
This commit is contained in:
parent
557fcb0931
commit
5a99ef09aa
4 changed files with 60 additions and 45 deletions
|
@ -232,18 +232,22 @@ export class AdminDialog extends IGBDialog {
|
|||
step.activeDialog.state.options.args.split(' ')[0] : null;
|
||||
|
||||
const packages = [];
|
||||
let skipError = false;
|
||||
if (filename === null || filename === "") {
|
||||
await min.conversationalService.sendText(min, step, `Starting publishing for ${botId}.gbkb...`);
|
||||
await min.conversationalService.sendText(min, step, `Starting publishing for ${botId} packages...`);
|
||||
packages.push(`${botId}.gbkb`);
|
||||
packages.push(`${botId}.gbtheme`);
|
||||
packages.push(`${botId}.gbdialog`);
|
||||
packages.push(`${botId}.gbot`);
|
||||
skipError = true;
|
||||
} else {
|
||||
await min.conversationalService.sendText(min, step, `Starting publishing for ${filename}...`);
|
||||
packages.push(filename);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
await CollectionUtil.asyncForEach(packages, async packageName => {
|
||||
|
||||
try {
|
||||
const cmd1 = `deployPackage ${process.env.STORAGE_SITE} /${process.env.STORAGE_LIBRARY}/${botId}.gbai/${packageName}`;
|
||||
|
||||
if (await (deployer as any).getStoragePackageByName(min.instance.instanceId,
|
||||
|
@ -253,12 +257,16 @@ export class AdminDialog extends IGBDialog {
|
|||
}
|
||||
await GBAdminService.deployPackageCommand(min, cmd1, deployer);
|
||||
await min.conversationalService.sendText(min, step, `Finished publishing ${packageName}.`);
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
await min.conversationalService.sendText(min, step, `ERROR: ${error}`);
|
||||
GBLog.error(error);
|
||||
if (!skipError) {
|
||||
await min.conversationalService.sendText(min, step, `ERROR: ${error}`);
|
||||
|
||||
return await step.replaceDialog('/ask', { isReturning: true });
|
||||
}
|
||||
}
|
||||
});
|
||||
await min.conversationalService.sendText(min, step, Messages[locale].publish_success);
|
||||
if (!step.activeDialog.state.options.confirm) {
|
||||
return await step.replaceDialog('/ask', { isReturning: true });
|
||||
|
|
|
@ -81,6 +81,7 @@ export class WelcomeDialog extends IGBDialog {
|
|||
: Messages[locale].good_night;
|
||||
|
||||
await min.conversationalService.sendText(min, step, Messages[locale].hi(msg));
|
||||
|
||||
await step.replaceDialog('/ask', { firstTime: true });
|
||||
|
||||
if (
|
||||
|
|
|
@ -666,6 +666,7 @@ export class GBMinService {
|
|||
const simpleLocale = context.activity.locale.substring(0, 2);
|
||||
const hasBadWord = wash.check(simpleLocale, context.activity.text);
|
||||
|
||||
|
||||
if (hasBadWord) {
|
||||
await step.beginDialog('/pleaseNoBadWords');
|
||||
} else if (isVMCall) {
|
||||
|
@ -693,6 +694,12 @@ export class GBMinService {
|
|||
await step.continueDialog();
|
||||
} else {
|
||||
|
||||
if (!await this.deployer.getStoragePackageByName(min.instance.instanceId, `${min.instance.botId}.gbkb`)) {
|
||||
await step.context.sendActivity(`Oi, ainda não possuo pacotes de conhecimento publicados. Por favor, aguarde alguns segundos enquanto eu auto-publico alguns pacotes.`);
|
||||
return await step.beginDialog('/publish', { confirm: true });
|
||||
}
|
||||
else {
|
||||
|
||||
let query = context.activity.text;
|
||||
|
||||
const translatorEnabled = () => {
|
||||
|
@ -733,6 +740,7 @@ export class GBMinService {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static async callVM(text: string, min: GBMinInstance, step: GBDialogStep) {
|
||||
const mainMethod = text.toLowerCase();
|
||||
|
|
|
@ -150,8 +150,6 @@ export class WhatsappDirectLine extends GBService {
|
|||
}
|
||||
|
||||
public async received(req, res) {
|
||||
|
||||
|
||||
if (req.body.messages === undefined) {
|
||||
res.end();
|
||||
return; // Exit here.
|
||||
|
|
Loading…
Add table
Reference in a new issue