Microsoft updated everything again, so we need to update it too.
This commit is contained in:
parent
820d4f612e
commit
677057c282
22 changed files with 333 additions and 314 deletions
|
@ -41,15 +41,13 @@ import { GBConfigService } from "../../core.gbapp/services/GBConfigService";
|
|||
import { BotAdapter } from "botbuilder";
|
||||
import { GBAdminService } from "../services/GBAdminService";
|
||||
import { Messages } from "../strings";
|
||||
|
||||
import { WaterfallDialog } from "botbuilder-dialogs";
|
||||
|
||||
/**
|
||||
* Dialogs for administration tasks.
|
||||
*/
|
||||
export class AdminDialog extends IGBDialog {
|
||||
|
||||
static async createFarmCommand(text: any, min: GBMinInstance) {
|
||||
}
|
||||
static async createFarmCommand(text: any, min: GBMinInstance) {}
|
||||
|
||||
static async undeployPackageCommand(text: any, min: GBMinInstance) {
|
||||
let packageName = text.split(" ")[1];
|
||||
|
@ -80,70 +78,75 @@ export class AdminDialog extends IGBDialog {
|
|||
let importer = new GBImporter(min.core);
|
||||
let deployer = new GBDeployer(min.core, importer);
|
||||
|
||||
min.dialogs.add("/admin", [
|
||||
async dc => {
|
||||
const locale = dc.context.activity.locale;
|
||||
const prompt = Messages[locale].authenticate;
|
||||
await dc.prompt("textPrompt", prompt);
|
||||
},
|
||||
async (dc, password) => {
|
||||
const locale = dc.context.activity.locale;
|
||||
if (
|
||||
password === GBConfigService.get("ADMIN_PASS") &&
|
||||
GBAdminService.StrongRegex.test(password)
|
||||
) {
|
||||
await dc.context.sendActivity(Messages[locale].welcome);
|
||||
await dc.prompt("textPrompt", Messages[locale].which_task);
|
||||
} else {
|
||||
await dc.prompt("textPrompt", Messages[locale].wrong_password);
|
||||
await dc.endAll();
|
||||
}
|
||||
},
|
||||
async (dc, value) => {
|
||||
const locale = dc.context.activity.locale;
|
||||
var text = value;
|
||||
let cmdName = text.split(" ")[0];
|
||||
min.dialogs.add(
|
||||
new WaterfallDialog("/admin", [
|
||||
async step => {
|
||||
const locale = step.context.activity.locale;
|
||||
const prompt = Messages[locale].authenticate;
|
||||
await step.prompt("textPrompt", prompt);
|
||||
return await step.next();
|
||||
},
|
||||
async step => {
|
||||
const locale = step.context.activity.locale;
|
||||
let password = step.result;
|
||||
if (
|
||||
password === GBConfigService.get("ADMIN_PASS") &&
|
||||
GBAdminService.StrongRegex.test(password)
|
||||
) {
|
||||
await step.context.sendActivity(Messages[locale].welcome);
|
||||
await step.prompt("textPrompt", Messages[locale].which_task);
|
||||
} else {
|
||||
await step.prompt("textPrompt", Messages[locale].wrong_password);
|
||||
await step.endDialog();
|
||||
}
|
||||
return await step.next();
|
||||
},
|
||||
async step => {
|
||||
const locale = step.context.activity.locale;
|
||||
var text = step.result;
|
||||
let cmdName = text.split(" ")[0];
|
||||
|
||||
dc.context.sendActivity(Messages[locale].working(cmdName));
|
||||
let unknownCommand = false;
|
||||
step.context.sendActivity(Messages[locale].working(cmdName));
|
||||
let unknownCommand = false;
|
||||
|
||||
if (text === "quit") {
|
||||
await dc.replace("/");
|
||||
} else if (cmdName === "createFarm") {
|
||||
await AdminDialog.createFarmCommand(text, deployer);
|
||||
await dc.replace("/admin", { firstRun: false });
|
||||
} else if (cmdName === "deployPackage") {
|
||||
await AdminDialog.deployPackageCommand(text, deployer);
|
||||
await dc.replace("/admin", { firstRun: false });
|
||||
} else if (cmdName === "redeployPackage") {
|
||||
await AdminDialog.undeployPackageCommand(text, min);
|
||||
await AdminDialog.deployPackageCommand(text, deployer);
|
||||
await dc.context.sendActivity();
|
||||
await dc.replace("/admin", { firstRun: false });
|
||||
} else if (cmdName === "undeployPackage") {
|
||||
await AdminDialog.undeployPackageCommand(text, min);
|
||||
await dc.replace("/admin", { firstRun: false });
|
||||
} else if (cmdName === "setupSecurity") {
|
||||
await AdminDialog.setupSecurity(min, dc);
|
||||
} else {
|
||||
unknownCommand = true;
|
||||
}
|
||||
if (text === "quit") {
|
||||
await step.replaceDialog("/");
|
||||
} else if (cmdName === "createFarm") {
|
||||
await AdminDialog.createFarmCommand(text, deployer);
|
||||
await step.replaceDialog("/admin", { firstRun: false });
|
||||
} else if (cmdName === "deployPackage") {
|
||||
await AdminDialog.deployPackageCommand(text, deployer);
|
||||
await step.replaceDialog("/admin", { firstRun: false });
|
||||
} else if (cmdName === "redeployPackage") {
|
||||
await AdminDialog.undeployPackageCommand(text, min);
|
||||
await AdminDialog.deployPackageCommand(text, deployer);
|
||||
await step.replaceDialog("/admin", { firstRun: false });
|
||||
} else if (cmdName === "undeployPackage") {
|
||||
await AdminDialog.undeployPackageCommand(text, min);
|
||||
await step.replaceDialog("/admin", { firstRun: false });
|
||||
} else if (cmdName === "setupSecurity") {
|
||||
await AdminDialog.setupSecurity(min, step);
|
||||
} else {
|
||||
unknownCommand = true;
|
||||
}
|
||||
|
||||
if (unknownCommand) {
|
||||
await dc.context.sendActivity(Messages[locale].unknown_command);
|
||||
} else {
|
||||
await dc.context.sendActivity(
|
||||
Messages[locale].finshed_working(cmdName)
|
||||
);
|
||||
if (unknownCommand) {
|
||||
await step.context.sendActivity(Messages[locale].unknown_command);
|
||||
} else {
|
||||
await step.context.sendActivity(
|
||||
Messages[locale].finshed_working(cmdName)
|
||||
);
|
||||
}
|
||||
await step.endDialog();
|
||||
await step.replaceDialog("/answer", { query: text });
|
||||
return await step.next();
|
||||
}
|
||||
await dc.endAll();
|
||||
await dc.replace("/answer", { query: text });
|
||||
}
|
||||
]);
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
private static async setupSecurity(min: any, dc: any) {
|
||||
const locale = dc.context.activity.locale;
|
||||
private static async setupSecurity(min: any, step: any) {
|
||||
const locale = step.activity.locale;
|
||||
let state = `${min.instance.instanceId}${Math.floor(
|
||||
Math.random() * 1000000000
|
||||
)}`;
|
||||
|
@ -160,6 +163,6 @@ export class AdminDialog extends IGBDialog {
|
|||
min.instance.botId
|
||||
}/token&state=${state}&response_mode=query`;
|
||||
|
||||
await dc.context.sendActivity(Messages[locale].consent(url));
|
||||
await step.sendActivity(Messages[locale].consent(url));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,6 +59,6 @@ export class GBAdminPackage implements IGBPackage {
|
|||
unloadBot(min: GBMinInstance): void {
|
||||
}
|
||||
|
||||
onNewSession(min: GBMinInstance, dc: any): void {
|
||||
onNewSession(min: GBMinInstance, step: any): void {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ export class GBAnalyticsPackage implements IGBPackage {
|
|||
unloadBot(min: GBMinInstance): void {
|
||||
|
||||
}
|
||||
onNewSession(min: GBMinInstance, dc: any): void {
|
||||
onNewSession(min: GBMinInstance, step: any): void {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,9 +48,9 @@ export class BotFarmDialog extends IGBDialog {
|
|||
*/
|
||||
static setup(bot: BotAdapter, min: GBMinInstance) {
|
||||
min.dialogs.add("/createBotFarm", [
|
||||
async dc => {
|
||||
let locale = dc.context.activity.locale;
|
||||
await dc.prompt("choicePrompt", Messages[locale].what_about_me, [
|
||||
async step => {
|
||||
let locale = step.context.activity.locale;
|
||||
await step.prompt("choicePrompt", Messages[locale].what_about_me, [
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
|
@ -58,9 +58,9 @@ export class BotFarmDialog extends IGBDialog {
|
|||
"5"
|
||||
]);
|
||||
},
|
||||
async (dc, value) => {
|
||||
let locale = dc.context.activity.locale;
|
||||
await dc.context.sendActivity(Messages[locale].thanks);
|
||||
async step => {
|
||||
let locale = step.context.activity.locale;
|
||||
await step.context.sendActivity(Messages[locale].thanks);
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ export class GBWhatsappPackage implements IGBPackage {
|
|||
unloadBot(min: GBMinInstance): void {
|
||||
|
||||
}
|
||||
onNewSession(min: GBMinInstance, dc: any): void {
|
||||
onNewSession(min: GBMinInstance, step: any): void {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,6 @@ export class GBConsolePackage implements IGBPackage {
|
|||
unloadBot(min: GBMinInstance): void {
|
||||
}
|
||||
|
||||
onNewSession(min: GBMinInstance, dc: any): void {
|
||||
onNewSession(min: GBMinInstance, step: any): void {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
import { IGBDialog } from "botlib";
|
||||
import { GBMinInstance } from "botlib";
|
||||
import { BotAdapter } from "botbuilder";
|
||||
import {WaterfallDialog } from "botbuilder-dialogs";
|
||||
import { Messages } from "../strings";
|
||||
|
||||
export class WelcomeDialog extends IGBDialog {
|
||||
|
@ -45,11 +46,12 @@ export class WelcomeDialog extends IGBDialog {
|
|||
* @param min The minimal bot instance data.
|
||||
*/
|
||||
static setup(bot: BotAdapter, min: GBMinInstance) {
|
||||
min.dialogs.add("/", [
|
||||
async (dc) => {
|
||||
const user = await min.userProfile.get(context, {});
|
||||
|
||||
min.dialogs.add(new WaterfallDialog("/", [
|
||||
async step => {
|
||||
|
||||
const locale = dc.context.activity.locale;
|
||||
const user = await min.userProfile.get(context, {});
|
||||
const locale = step.context.activity.locale;
|
||||
|
||||
if (!user.once) {
|
||||
user.once = true;
|
||||
|
@ -63,18 +65,19 @@ export class WelcomeDialog extends IGBDialog {
|
|||
? Messages[locale].good_evening
|
||||
: Messages[locale].good_night;
|
||||
|
||||
await dc.context.sendActivity(Messages[locale].hi(msg));
|
||||
await dc.replace("/ask", { firstTime: true });
|
||||
await step.context.sendActivity(Messages[locale].hi(msg));
|
||||
await step.replaceDialog("/ask", { firstTime: true });
|
||||
|
||||
if (
|
||||
dc.context.activity &&
|
||||
dc.context.activity.type == "message" &&
|
||||
dc.context.activity.text != ""
|
||||
step.context.activity &&
|
||||
step.context.activity.type == "message" &&
|
||||
step.context.activity.text != ""
|
||||
) {
|
||||
await dc.replace("/answer", { query: dc.context.activity.text });
|
||||
await step.replaceDialog("/answer", { query: step.context.activity.text });
|
||||
}
|
||||
}
|
||||
return await step.next();
|
||||
}
|
||||
]);
|
||||
]))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ import { IGBDialog } from "botlib";
|
|||
import { GBMinInstance } from "botlib";
|
||||
import { BotAdapter } from "botbuilder";
|
||||
import { Messages } from "../strings";
|
||||
import { WaterfallDialog } from "botbuilder-dialogs";
|
||||
|
||||
export class WhoAmIDialog extends IGBDialog {
|
||||
/**
|
||||
|
@ -45,21 +46,22 @@ export class WhoAmIDialog extends IGBDialog {
|
|||
* @param min The minimal bot instance data.
|
||||
*/
|
||||
static setup(bot: BotAdapter, min: GBMinInstance) {
|
||||
min.dialogs.add("/whoAmI", [
|
||||
async dc => {
|
||||
let locale = dc.context.activity.locale;
|
||||
await dc.context.sendActivity(`${min.instance.description}`);
|
||||
min.dialogs.add(new WaterfallDialog("/whoAmI", [
|
||||
async step => {
|
||||
let locale = step.context.activity.locale;
|
||||
await step.context.sendActivity(`${min.instance.description}`);
|
||||
|
||||
if (min.instance.whoAmIVideo) {
|
||||
await dc.context.sendActivity(Messages[locale].show_video);
|
||||
await min.conversationalService.sendEvent(dc, "play", {
|
||||
await step.context.sendActivity(Messages[locale].show_video);
|
||||
await min.conversationalService.sendEvent(step, "play", {
|
||||
playerType: "video",
|
||||
data: min.instance.whoAmIVideo.trim()
|
||||
});
|
||||
}
|
||||
|
||||
await dc.replace("/ask", { isReturning: true });
|
||||
await step.replaceDialog("/ask", { isReturning: true });
|
||||
return await step.next();
|
||||
}
|
||||
]);
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ export class GBCorePackage implements IGBPackage {
|
|||
unloadBot(min: GBMinInstance): void {
|
||||
|
||||
}
|
||||
onNewSession(min: GBMinInstance, dc: any): void {
|
||||
onNewSession(min: GBMinInstance, step: any): void {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,17 +56,17 @@ export class GBConversationalService implements IGBConversationalService {
|
|||
this.coreService = coreService;
|
||||
}
|
||||
|
||||
getCurrentLanguage(dc: any) {
|
||||
return dc.context.activity.locale;
|
||||
getCurrentLanguage(step: any) {
|
||||
return step.context.activity.locale;
|
||||
}
|
||||
|
||||
async sendEvent(dc: any, name: string, value: any): Promise<any> {
|
||||
if (dc.context.activity.channelId === "webchat") {
|
||||
async sendEvent(step: any, name: string, value: any): Promise<any> {
|
||||
if (step.context.activity.channelId === "webchat") {
|
||||
const msg = MessageFactory.text("");
|
||||
msg.value = value;
|
||||
msg.type = "event";
|
||||
msg.name = name;
|
||||
return dc.context.sendActivity(msg);
|
||||
return step.context.sendActivity(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ export class GBConversationalService implements IGBConversationalService {
|
|||
});
|
||||
}
|
||||
|
||||
async routeNLP(dc: any, min: GBMinInstance, text: string): Promise<boolean> {
|
||||
async routeNLP(step: any, min: GBMinInstance, text: string): Promise<boolean> {
|
||||
// Invokes LUIS.
|
||||
|
||||
const model = new LuisRecognizer({
|
||||
|
@ -106,7 +106,7 @@ export class GBConversationalService implements IGBConversationalService {
|
|||
|
||||
let nlp: any;
|
||||
try {
|
||||
nlp = await model.recognize(dc.context);
|
||||
nlp = await model.recognize(step.context);
|
||||
} catch (error) {
|
||||
let msg = `Error calling NLP server, check if you have a published model and assigned keys on the service. Error: ${
|
||||
error.statusCode ? error.statusCode : ""
|
||||
|
@ -131,7 +131,7 @@ export class GBConversationalService implements IGBConversationalService {
|
|||
logger.info("NLP called:" + intent + ", " + entity);
|
||||
|
||||
try {
|
||||
await dc.replace("/" + intent, nlp.entities);
|
||||
await step.replace("/" + intent, nlp.entities);
|
||||
return Promise.resolve(true);
|
||||
} catch (error) {
|
||||
let msg = `Error finding dialog associated to NLP event: ${intent}: ${
|
||||
|
@ -143,24 +143,24 @@ export class GBConversationalService implements IGBConversationalService {
|
|||
return Promise.resolve(false);
|
||||
}
|
||||
|
||||
async checkLanguage(dc, min, text) {
|
||||
async checkLanguage(step, min, text) {
|
||||
let locale = await AzureText.getLocale(
|
||||
min.instance.textAnalyticsKey,
|
||||
min.instance.textAnalyticsEndpoint,
|
||||
text
|
||||
);
|
||||
if (locale != dc.context.activity.locale.split("-")[0]) {
|
||||
if (locale != step.context.activity.locale.split("-")[0]) {
|
||||
switch (locale) {
|
||||
case "pt":
|
||||
dc.context.activity.locale = "pt-BR";
|
||||
await dc.context.sendActivity(Messages[locale].changing_language);
|
||||
step.context.activity.locale = "pt-BR";
|
||||
await step.context.sendActivity(Messages[locale].changing_language);
|
||||
break;
|
||||
case "en":
|
||||
dc.context.activity.locale = "en-US";
|
||||
await dc.context.sendActivity(Messages[locale].changing_language);
|
||||
step.context.activity.locale = "en-US";
|
||||
await step.context.sendActivity(Messages[locale].changing_language);
|
||||
break;
|
||||
default:
|
||||
await dc.context.sendActivity(`Unknown language: ${locale}`);
|
||||
await step.context.sendActivity(`Unknown language: ${locale}`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -329,30 +329,31 @@ export class GBMinService {
|
|||
}
|
||||
|
||||
private invokeLoadBot(appPackages: any[], min: any, server: any) {
|
||||
|
||||
let sysPackages = new Array<IGBPackage>();
|
||||
// NOTE: A semicolon is necessary before this line.
|
||||
[
|
||||
GBCorePackage,
|
||||
GBSecurityPackage,
|
||||
GBAdminPackage,
|
||||
GBKBPackage,
|
||||
GBAnalyticsPackage,
|
||||
GBCustomerSatisfactionPackage,
|
||||
GBWhatsappPackage
|
||||
].forEach(sysPackage => {
|
||||
let p = Object.create(sysPackage.prototype) as IGBPackage;
|
||||
p.loadBot(min);
|
||||
sysPackages.push(p);
|
||||
if (sysPackage.name === "GBWhatsappPackage") {
|
||||
let url = "/instances/:botId/whatsapp";
|
||||
server.post(url, (req, res) => {
|
||||
p["channel"].received(req, res);
|
||||
});
|
||||
}
|
||||
}, this);
|
||||
|
||||
appPackages.forEach(e => {
|
||||
e.sysPackages = new Array<IGBPackage>();
|
||||
|
||||
// NOTE: A semicolon is necessary before this line.
|
||||
|
||||
[
|
||||
GBAdminPackage,
|
||||
GBAnalyticsPackage,
|
||||
GBCorePackage,
|
||||
GBSecurityPackage,
|
||||
GBKBPackage,
|
||||
GBCustomerSatisfactionPackage,
|
||||
GBWhatsappPackage
|
||||
].forEach(sysPackage => {
|
||||
let p = Object.create(sysPackage.prototype) as IGBPackage;
|
||||
p.loadBot(min);
|
||||
e.sysPackages.push(p);
|
||||
if (sysPackage.name === "GBWhatsappPackage") {
|
||||
let url = "/instances/:botId/whatsapp";
|
||||
server.post(url, (req, res) => {
|
||||
p["channel"].received(req, res);
|
||||
});
|
||||
}
|
||||
}, this);
|
||||
e.sysPackages = sysPackages;
|
||||
e.loadBot(min);
|
||||
}, this);
|
||||
}
|
||||
|
@ -371,14 +372,14 @@ export class GBMinService {
|
|||
) {
|
||||
return adapter.processActivity(req, res, async context => {
|
||||
const state = conversationState.get(context);
|
||||
const dc = await min.dialogs.createContext(context, state);
|
||||
dc.context.activity.locale = "en-US"; // TODO: Make dynamic.
|
||||
const step = await min.dialogs.createContext(context, state);
|
||||
step.context.activity.locale = "en-US"; // TODO: Make dynamic.
|
||||
|
||||
try {
|
||||
const user = await min.userProfile.get(context, {});
|
||||
|
||||
if (!user.loaded) {
|
||||
await min.conversationalService.sendEvent(dc, "loadInstance", {
|
||||
await min.conversationalService.sendEvent(step, "loadInstance", {
|
||||
instanceId: instance.instanceId,
|
||||
botId: instance.botId,
|
||||
theme: instance.theme,
|
||||
|
@ -402,11 +403,11 @@ export class GBMinService {
|
|||
if (member.name === "GeneralBots") {
|
||||
logger.info(`Bot added to conversation, starting chat...`);
|
||||
appPackages.forEach(e => {
|
||||
e.onNewSession(min, dc);
|
||||
e.onNewSession(min, step);
|
||||
});
|
||||
// Processes the root dialog.
|
||||
|
||||
await dc.beginDialog("/");
|
||||
await step.beginDialog("/");
|
||||
} else {
|
||||
logger.info(`Member added to conversation: ${member.name}`);
|
||||
}
|
||||
|
@ -416,20 +417,20 @@ export class GBMinService {
|
|||
// Checks for /admin request.
|
||||
|
||||
if (context.activity.text === "admin") {
|
||||
await dc.beginDialog("/admin");
|
||||
await step.beginDialog("/admin");
|
||||
|
||||
// Checks for /menu JSON signature.
|
||||
} else if (context.activity.text.startsWith('{"title"')) {
|
||||
await dc.beginDialog("/menu", {
|
||||
await step.beginDialog("/menu", {
|
||||
data: JSON.parse(context.activity.text)
|
||||
});
|
||||
|
||||
// Otherwise, continue to the active dialog in the stack.
|
||||
} else {
|
||||
if (dc.activeDialog) {
|
||||
await dc.continue();
|
||||
if (step.activeDialog) {
|
||||
await step.continue();
|
||||
} else {
|
||||
await dc.beginDialog("/answer", { query: context.activity.text });
|
||||
await step.beginDialog("/answer", { query: context.activity.text });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -437,42 +438,42 @@ export class GBMinService {
|
|||
} else if (context.activity.type === "event") {
|
||||
// Empties dialog stack before going to the target.
|
||||
|
||||
await dc.endAll();
|
||||
await step.endAll();
|
||||
|
||||
if (context.activity.name === "whoAmI") {
|
||||
await dc.beginDialog("/whoAmI");
|
||||
await step.beginDialog("/whoAmI");
|
||||
} else if (context.activity.name === "showSubjects") {
|
||||
await dc.beginDialog("/menu");
|
||||
await step.beginDialog("/menu");
|
||||
} else if (context.activity.name === "giveFeedback") {
|
||||
await dc.beginDialog("/feedback", {
|
||||
await step.beginDialog("/feedback", {
|
||||
fromMenu: true
|
||||
});
|
||||
} else if (context.activity.name === "showFAQ") {
|
||||
await dc.beginDialog("/faq");
|
||||
await step.beginDialog("/faq");
|
||||
} else if (context.activity.name === "answerEvent") {
|
||||
await dc.beginDialog("/answerEvent", {
|
||||
await step.beginDialog("/answerEvent", {
|
||||
questionId: (context.activity as any).data,
|
||||
fromFaq: true
|
||||
});
|
||||
} else if (context.activity.name === "quality") {
|
||||
await dc.beginDialog("/quality", {
|
||||
await step.beginDialog("/quality", {
|
||||
score: (context.activity as any).data
|
||||
});
|
||||
} else if (context.activity.name === "updateToken") {
|
||||
let token = (context.activity as any).data;
|
||||
await dc.beginDialog("/adminUpdateToken", { token: token });
|
||||
await step.beginDialog("/adminUpdateToken", { token: token });
|
||||
} else {
|
||||
await dc.continue();
|
||||
await step.continue();
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
let msg = `ERROR: ${error.message} ${error.stack ? error.stack : ""}`;
|
||||
logger.error(msg);
|
||||
|
||||
await dc.context.sendActivity(
|
||||
Messages[dc.context.activity.locale].very_sorry_about_error
|
||||
await step.context.sendActivity(
|
||||
Messages[step.context.activity.locale].very_sorry_about_error
|
||||
);
|
||||
await dc.beginDialog("/ask", { isReturning: true });
|
||||
await step.beginDialog("/ask", { isReturning: true });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import { GBMinInstance } from "botlib";
|
|||
import { IGBDialog } from "botlib";
|
||||
import { BotAdapter } from "botbuilder";
|
||||
import { Messages } from "../strings";
|
||||
import { WaterfallDialog } from "botbuilder-dialogs";
|
||||
|
||||
export class FeedbackDialog extends IGBDialog {
|
||||
/**
|
||||
|
@ -49,53 +50,59 @@ export class FeedbackDialog extends IGBDialog {
|
|||
static setup(bot: BotAdapter, min: GBMinInstance) {
|
||||
const service = new CSService();
|
||||
|
||||
min.dialogs.add("/feedbackNumber", [
|
||||
async dc => {
|
||||
let locale = dc.context.activity.locale;
|
||||
await dc.prompt("choicePrompt", Messages[locale].what_about_me, [
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5"
|
||||
]);
|
||||
},
|
||||
async (dc, value) => {
|
||||
let locale = dc.context.activity.locale;
|
||||
let rate = value.entity;
|
||||
const user = await min.userProfile.get(context, {});
|
||||
await service.updateConversationRate(user.conversation, rate);
|
||||
await dc.context.sendActivity(Messages[locale].thanks);
|
||||
}
|
||||
]);
|
||||
|
||||
min.dialogs.add("/feedback", [
|
||||
async (dc, args) => {
|
||||
let locale = dc.context.activity.locale;
|
||||
if (args && args.fromMenu) {
|
||||
await dc.context.sendActivity(Messages[locale].about_suggestions);
|
||||
min.dialogs.add(
|
||||
new WaterfallDialog("/feedbackNumber", [
|
||||
async step => {
|
||||
let locale = step.context.activity.locale;
|
||||
// TODO: Migrate to 4.*+ await step.prompt("choicePrompt", Messages[locale].what_about_me, [
|
||||
// "1",
|
||||
// "2",
|
||||
// "3",
|
||||
// "4",
|
||||
// "5"
|
||||
// ]);
|
||||
return await step.next();
|
||||
},
|
||||
async step => {
|
||||
let locale = step.context.activity.locale;
|
||||
let rate = step.result.entity;
|
||||
const user = await min.userProfile.get(context, {});
|
||||
await service.updateConversationRate(user.conversation, rate);
|
||||
await step.context.sendActivity(Messages[locale].thanks);
|
||||
return await step.next();
|
||||
}
|
||||
])
|
||||
);
|
||||
|
||||
min.dialogs.add(new WaterfallDialog("/feedback", [
|
||||
async step => {
|
||||
let locale = step.context.activity.locale;
|
||||
if (step.result.fromMenu) {
|
||||
await step.context.sendActivity(Messages[locale].about_suggestions);
|
||||
}
|
||||
|
||||
await dc.prompt("textPrompt", Messages[locale].what_about_service);
|
||||
await step.prompt("textPrompt", Messages[locale].what_about_service);
|
||||
return await step.next();
|
||||
},
|
||||
async (dc, value) => {
|
||||
let locale = dc.context.activity.locale;
|
||||
async step => {
|
||||
let locale = step.context.activity.locale;
|
||||
let rate = await AzureText.getSentiment(
|
||||
min.instance.textAnalyticsKey,
|
||||
min.instance.textAnalyticsEndpoint,
|
||||
min.conversationalService.getCurrentLanguage(dc),
|
||||
value
|
||||
min.conversationalService.getCurrentLanguage(step),
|
||||
step.result
|
||||
);
|
||||
|
||||
if (rate > 0.5) {
|
||||
await dc.context.sendActivity(Messages[locale].glad_you_liked);
|
||||
await step.context.sendActivity(Messages[locale].glad_you_liked);
|
||||
} else {
|
||||
await dc.context.sendActivity(Messages[locale].we_will_improve);
|
||||
await step.context.sendActivity(Messages[locale].we_will_improve);
|
||||
|
||||
// TODO: Record.
|
||||
}
|
||||
await dc.replace("/ask", { isReturning: true });
|
||||
await step.replaceDialog("/ask", { isReturning: true });
|
||||
return await step.next();
|
||||
}
|
||||
]);
|
||||
]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import { GBMinInstance } from "botlib";
|
|||
import { CSService } from "../services/CSService";
|
||||
import { BotAdapter } from "botbuilder";
|
||||
import { Messages } from "../strings";
|
||||
import { WaterfallDialog } from "botbuilder-dialogs";
|
||||
const logger = require("../../../src/logger");
|
||||
|
||||
export class QualityDialog extends IGBDialog {
|
||||
|
@ -50,31 +51,32 @@ export class QualityDialog extends IGBDialog {
|
|||
static setup(bot: BotAdapter, min: GBMinInstance) {
|
||||
const service = new CSService();
|
||||
|
||||
min.dialogs.add("/quality", [
|
||||
async (dc, args) => {
|
||||
const locale = dc.context.activity.locale;
|
||||
min.dialogs.add( new WaterfallDialog("/quality", [
|
||||
async step => {
|
||||
const locale = step.context.activity.locale;
|
||||
const user = await min.userProfile.get(context, {});
|
||||
|
||||
var score = args.score;
|
||||
var score = step.result;
|
||||
|
||||
setTimeout(
|
||||
() => min.conversationalService.sendEvent(dc, "stop", null),
|
||||
() => min.conversationalService.sendEvent(step, "stop", null),
|
||||
400
|
||||
);
|
||||
|
||||
if (score == 0) {
|
||||
await dc.context.sendActivity(Messages[locale].im_sorry_lets_try);
|
||||
await step.context.sendActivity(Messages[locale].im_sorry_lets_try);
|
||||
} else {
|
||||
await dc.context.sendActivity(Messages[locale].great_thanks);
|
||||
await step.context.sendActivity(Messages[locale].great_thanks);
|
||||
|
||||
await service.insertQuestionAlternate(
|
||||
min.instance.instanceId,
|
||||
user.lastQuestion,
|
||||
user.lastQuestionId
|
||||
);
|
||||
await dc.replace("/ask", { isReturning: true });
|
||||
await step.replaceDialog("/ask", { isReturning: true });
|
||||
}
|
||||
return await step.next();
|
||||
}
|
||||
]);
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ export class GBCustomerSatisfactionPackage implements IGBPackage {
|
|||
unloadBot(min: GBMinInstance): void {
|
||||
|
||||
}
|
||||
onNewSession(min: GBMinInstance, dc: any): void {
|
||||
onNewSession(min: GBMinInstance, step: any): void {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,8 +38,7 @@ import { GBMinInstance } from "botlib";
|
|||
import { KBService } from "./../services/KBService";
|
||||
import { BotAdapter } from "botbuilder";
|
||||
import { Messages } from "../strings";
|
||||
import { LuisRecognizer } from "botbuilder-ai";
|
||||
import { GuaribasQuestion } from "../models";
|
||||
import { WaterfallDialog } from "botbuilder-dialogs";
|
||||
|
||||
const logger = require("../../../src/logger");
|
||||
|
||||
|
@ -53,12 +52,12 @@ export class AskDialog extends IGBDialog {
|
|||
static setup(bot: BotAdapter, min: GBMinInstance) {
|
||||
const service = new KBService(min.core.sequelize);
|
||||
|
||||
min.dialogs.add("/answerEvent", [
|
||||
async (dc, args) => {
|
||||
if (args && args.questionId) {
|
||||
min.dialogs.add(new WaterfallDialog("/answerEvent", [
|
||||
async step => {
|
||||
if (step.result && step.result.questionId) {
|
||||
let question = await service.getQuestionById(
|
||||
min.instance.instanceId,
|
||||
args.questionId
|
||||
step.result.questionId
|
||||
);
|
||||
let answer = await service.getAnswerById(
|
||||
min.instance.instanceId,
|
||||
|
@ -67,34 +66,34 @@ export class AskDialog extends IGBDialog {
|
|||
|
||||
// Sends the answer to all outputs, including projector.
|
||||
|
||||
await service.sendAnswer(min.conversationalService, dc, answer);
|
||||
await service.sendAnswer(min.conversationalService, step, answer);
|
||||
|
||||
await dc.replace("/ask", { isReturning: true });
|
||||
await step.replaceDialog("/ask", { isReturning: true });
|
||||
}
|
||||
return await step.next();
|
||||
}
|
||||
]);
|
||||
]));
|
||||
|
||||
min.dialogs.add("/answer", [
|
||||
async (dc, args) => {
|
||||
min.dialogs.add(new WaterfallDialog("/answer", [
|
||||
async step => {
|
||||
const user = await min.userProfile.get(context, {});
|
||||
|
||||
let text = args.query;
|
||||
let text = step.result.query;
|
||||
if (!text) {
|
||||
throw new Error(`/answer being called with no args.query text.`);
|
||||
}
|
||||
|
||||
let locale = dc.context.activity.locale;
|
||||
let locale = step.context.activity.locale;
|
||||
|
||||
// Stops any content on projector.
|
||||
|
||||
await min.conversationalService.sendEvent(dc, "stop", null);
|
||||
await min.conversationalService.sendEvent(step, "stop", null);
|
||||
|
||||
// Handle extra text from FAQ.
|
||||
|
||||
if (args && args.query) {
|
||||
text = args.query;
|
||||
} else if (args && args.fromFaq) {
|
||||
await dc.context.sendActivity(Messages[locale].going_answer);
|
||||
if (step.result && step.result.query) {
|
||||
text = step.result.query;
|
||||
} else if (step.result && step.result.fromFaq) {
|
||||
await step.context.sendActivity(Messages[locale].going_answer);
|
||||
}
|
||||
|
||||
// Spells check the input text before sending Search or NLP.
|
||||
|
@ -135,13 +134,13 @@ export class AskDialog extends IGBDialog {
|
|||
|
||||
await service.sendAnswer(
|
||||
min.conversationalService,
|
||||
dc,
|
||||
step,
|
||||
resultsA.answer
|
||||
);
|
||||
|
||||
// Goes to ask loop, again.
|
||||
|
||||
await dc.replace("/ask", { isReturning: true });
|
||||
await step.replaceDialog("/ask", { isReturning: true });
|
||||
} else {
|
||||
// Second time running Search, now with no filter.
|
||||
|
||||
|
@ -169,30 +168,31 @@ export class AskDialog extends IGBDialog {
|
|||
let subjectText = `${KBService.getSubjectItemsSeparatedBySpaces(
|
||||
user.subjects
|
||||
)}`;
|
||||
await dc.context.sendActivity(Messages[locale].wider_answer);
|
||||
await step.context.sendActivity(Messages[locale].wider_answer);
|
||||
}
|
||||
|
||||
// Sends the answer to all outputs, including projector.
|
||||
|
||||
await service.sendAnswer(
|
||||
min.conversationalService,
|
||||
dc,
|
||||
step,
|
||||
resultsB.answer
|
||||
);
|
||||
await dc.replace("/ask", { isReturning: true });
|
||||
await step.replaceDialog("/ask", { isReturning: true });
|
||||
} else {
|
||||
if (!(await min.conversationalService.routeNLP(dc, min, text))) {
|
||||
await dc.context.sendActivity(Messages[locale].did_not_find);
|
||||
await dc.replace("/ask", { isReturning: true });
|
||||
if (!(await min.conversationalService.routeNLP(step, min, text))) {
|
||||
await step.context.sendActivity(Messages[locale].did_not_find);
|
||||
await step.replaceDialog("/ask", { isReturning: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
return await step.next();
|
||||
}
|
||||
]);
|
||||
]));
|
||||
|
||||
min.dialogs.add("/ask", [
|
||||
async (dc, args) => {
|
||||
const locale = dc.context.activity.locale;
|
||||
min.dialogs.add(new WaterfallDialog("/ask", [
|
||||
async step => {
|
||||
const locale = step.context.activity.locale;
|
||||
const user = await min.userProfile.get(context, {});
|
||||
user.isAsking = true;
|
||||
if (!user.subjects) {
|
||||
|
@ -202,9 +202,9 @@ export class AskDialog extends IGBDialog {
|
|||
|
||||
// Three forms of asking.
|
||||
|
||||
if (args && args.firstTime) {
|
||||
if (step.result && step.result.firstTime) {
|
||||
text = Messages[locale].ask_first_time;
|
||||
} else if (args && args.isReturning) {
|
||||
} else if (step.result && step.result.isReturning) {
|
||||
text = Messages[locale].anything_else;
|
||||
} else if (user.subjects.length > 0) {
|
||||
text = Messages[locale].which_question;
|
||||
|
@ -213,13 +213,14 @@ export class AskDialog extends IGBDialog {
|
|||
}
|
||||
|
||||
if (text.length > 0) {
|
||||
await dc.prompt("textPrompt", text);
|
||||
// TODO: await step.prompt("textPrompt", text:text);
|
||||
}
|
||||
return await step.next();
|
||||
},
|
||||
async (dc, value) => {
|
||||
await dc.endAll();
|
||||
await dc.beginDialog("/answer", { query: value });
|
||||
async step => {
|
||||
await step.replaceDialog("/answer", { query: step.result });
|
||||
return await step.next();
|
||||
}
|
||||
]);
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ import { IGBDialog } from "botlib"
|
|||
import { BotAdapter } from "botbuilder"
|
||||
import { Messages } from "../strings";
|
||||
import { GBMinInstance } from "botlib"
|
||||
import { WaterfallDialog } from 'botbuilder-dialogs';
|
||||
|
||||
export class FaqDialog extends IGBDialog {
|
||||
/**
|
||||
|
@ -49,20 +50,21 @@ export class FaqDialog extends IGBDialog {
|
|||
|
||||
const service = new KBService(min.core.sequelize)
|
||||
|
||||
min.dialogs.add("/faq", [
|
||||
async (dc, args) => {
|
||||
min.dialogs.add(new WaterfallDialog("/faq", [
|
||||
async step => {
|
||||
let data = await service.getFaqBySubjectArray("faq", null)
|
||||
const locale = dc.context.activity.locale;
|
||||
const locale = step.context.activity.locale;
|
||||
if (data) {
|
||||
await min.conversationalService.sendEvent(dc, "play", {
|
||||
await min.conversationalService.sendEvent(step, "play", {
|
||||
playerType: "bullet",
|
||||
data: data.slice(0, 10)
|
||||
})
|
||||
|
||||
await dc.context.sendActivity(Messages[locale].see_faq) // TODO: RND messages.
|
||||
await dc.endAll()
|
||||
await step.context.sendActivity(Messages[locale].see_faq) // TODO: RND messages.
|
||||
await step.endDialog()
|
||||
return await step.next();
|
||||
}
|
||||
}
|
||||
])
|
||||
]))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,17 +30,18 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict"
|
||||
"use strict";
|
||||
|
||||
const UrlJoin = require("url-join")
|
||||
const UrlJoin = require("url-join");
|
||||
|
||||
import { BotAdapter, CardFactory, MessageFactory } from "botbuilder"
|
||||
import { IGBDialog } from "botlib"
|
||||
import { GBMinInstance } from "botlib"
|
||||
import { GuaribasSubject } from "../models"
|
||||
import { KBService } from "../services/KBService"
|
||||
import { Messages } from "../strings"
|
||||
import { AzureText } from "pragmatismo-io-framework"
|
||||
import { BotAdapter, CardFactory, MessageFactory } from "botbuilder";
|
||||
import { IGBDialog } from "botlib";
|
||||
import { GBMinInstance } from "botlib";
|
||||
import { GuaribasSubject } from "../models";
|
||||
import { KBService } from "../services/KBService";
|
||||
import { Messages } from "../strings";
|
||||
import { AzureText } from "pragmatismo-io-framework";
|
||||
import { WaterfallDialog } from "botbuilder-dialogs";
|
||||
|
||||
export class MenuDialog extends IGBDialog {
|
||||
/**
|
||||
|
@ -50,30 +51,30 @@ export class MenuDialog extends IGBDialog {
|
|||
* @param min The minimal bot instance data.
|
||||
*/
|
||||
static setup(bot: BotAdapter, min: GBMinInstance) {
|
||||
var service = new KBService(min.core.sequelize)
|
||||
var service = new KBService(min.core.sequelize);
|
||||
|
||||
min.dialogs.add("/menu", [
|
||||
async (dc, args) => {
|
||||
const locale = dc.context.activity.locale
|
||||
var rootSubjectId = null
|
||||
min.dialogs.add(new WaterfallDialog("/menu", [
|
||||
async step => {
|
||||
const locale = step.context.activity.locale;
|
||||
var rootSubjectId = null;
|
||||
|
||||
if (args && args.data) {
|
||||
var subject = args.data
|
||||
if (step.result && step.result.data) {
|
||||
var subject = step.result.data;
|
||||
|
||||
// If there is a shortcut specified as subject destination, go there.
|
||||
|
||||
if (subject.to) {
|
||||
let dialog = subject.to.split(":")[1]
|
||||
await dc.replace("/" + dialog)
|
||||
await dc.end()
|
||||
return
|
||||
let dialog = subject.to.split(":")[1];
|
||||
await step.replaceDialog("/" + dialog);
|
||||
await step.endDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
// Adds to bot a perception of a new subject.
|
||||
|
||||
const user = await min.userProfile.get(context, {});
|
||||
user.subjects.push(subject)
|
||||
rootSubjectId = subject.subjectId
|
||||
const user = await min.userProfile.get(context, {});
|
||||
user.subjects.push(subject);
|
||||
rootSubjectId = subject.subjectId;
|
||||
|
||||
// Whenever a subject is selected, shows a faq about it.
|
||||
|
||||
|
@ -81,42 +82,37 @@ export class MenuDialog extends IGBDialog {
|
|||
let data = await service.getFaqBySubjectArray(
|
||||
"menu",
|
||||
user.subjects
|
||||
)
|
||||
await min.conversationalService.sendEvent(dc, "play", {
|
||||
);
|
||||
await min.conversationalService.sendEvent(step, "play", {
|
||||
playerType: "bullet",
|
||||
data: data.slice(0, 10)
|
||||
})
|
||||
});
|
||||
}
|
||||
} else {
|
||||
const user = await min.userProfile.get(context, {});
|
||||
user.subjects = []
|
||||
const user = await min.userProfile.get(context, {});
|
||||
user.subjects = [];
|
||||
|
||||
await dc.context.sendActivity(Messages[locale].here_is_subjects) // TODO: Handle rnd.
|
||||
user.isAsking = false
|
||||
await step.context.sendActivity(Messages[locale].here_is_subjects); // TODO: Handle rnd.
|
||||
user.isAsking = false;
|
||||
}
|
||||
|
||||
const msg = MessageFactory.text("")
|
||||
var attachments = []
|
||||
const msg = MessageFactory.text("");
|
||||
var attachments = [];
|
||||
|
||||
let data = await service.getSubjectItems(
|
||||
min.instance.instanceId,
|
||||
rootSubjectId
|
||||
)
|
||||
);
|
||||
|
||||
msg.attachmentLayout = "carousel"
|
||||
msg.attachmentLayout = "carousel";
|
||||
|
||||
data.forEach(function(item: GuaribasSubject) {
|
||||
var subject = item
|
||||
var subject = item;
|
||||
var card = CardFactory.heroCard(
|
||||
subject.title,
|
||||
subject.description,
|
||||
CardFactory.images([
|
||||
UrlJoin(
|
||||
"/kb",
|
||||
min.instance.kb,
|
||||
"subjects",
|
||||
"subject.png"
|
||||
)
|
||||
UrlJoin("/kb", min.instance.kb, "subjects", "subject.png")
|
||||
]),
|
||||
CardFactory.actions([
|
||||
{
|
||||
|
@ -131,40 +127,42 @@ export class MenuDialog extends IGBDialog {
|
|||
})
|
||||
}
|
||||
])
|
||||
)
|
||||
);
|
||||
|
||||
attachments.push(card)
|
||||
})
|
||||
attachments.push(card);
|
||||
});
|
||||
|
||||
if (attachments.length == 0) {
|
||||
const user = await min.userProfile.get(context, {});
|
||||
const user = await min.userProfile.get(context, {});
|
||||
|
||||
if (user.subjects && user.subjects.length > 0) {
|
||||
await dc.context.sendActivity(
|
||||
await step.context.sendActivity(
|
||||
Messages[locale].lets_search(
|
||||
KBService.getFormattedSubjectItems(user.subjects)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
await dc.replace("/ask", {})
|
||||
await step.replaceDialog("/ask", {});
|
||||
} else {
|
||||
msg.attachments = attachments
|
||||
await dc.context.sendActivity(msg)
|
||||
msg.attachments = attachments;
|
||||
await step.context.sendActivity(msg);
|
||||
}
|
||||
|
||||
const user = await min.userProfile.get(context, {});
|
||||
user.isAsking = true
|
||||
const user = await min.userProfile.get(context, {});
|
||||
user.isAsking = true;
|
||||
return await step.next();
|
||||
},
|
||||
async (dc, value) => {
|
||||
var text = value
|
||||
const locale = dc.context.activity.locale
|
||||
async step => {
|
||||
var text = step.result;
|
||||
const locale = step.context.activity.locale;
|
||||
if (AzureText.isIntentNo(locale, text)) {
|
||||
await dc.replace("/feedback")
|
||||
await step.replaceDialog("/feedback");
|
||||
} else {
|
||||
await dc.replace("/ask")
|
||||
await step.replaceDialog("/ask");
|
||||
}
|
||||
return await step.next();
|
||||
}
|
||||
])
|
||||
]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ export class GBKBPackage implements IGBPackage {
|
|||
unloadBot(min: GBMinInstance): void {
|
||||
|
||||
}
|
||||
onNewSession(min: GBMinInstance, dc: any): void {
|
||||
onNewSession(min: GBMinInstance, step: any): void {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -342,18 +342,18 @@ export class KBService {
|
|||
}
|
||||
|
||||
async sendAnswer(conversationalService: IGBConversationalService,
|
||||
dc: any, answer: GuaribasAnswer) {
|
||||
step: any, answer: GuaribasAnswer) {
|
||||
|
||||
if (answer.content.endsWith('.mp4')) {
|
||||
await conversationalService.sendEvent(dc, "play", {
|
||||
await conversationalService.sendEvent(step, "play", {
|
||||
playerType: "video",
|
||||
data: answer.content
|
||||
})
|
||||
} else if (answer.content.length > 140 &&
|
||||
dc.context._activity.channelId === "webchat") {
|
||||
const locale = dc.context.activity.locale;
|
||||
step.context._activity.channelId === "webchat") {
|
||||
const locale = step.context.activity.locale;
|
||||
|
||||
await dc.context.sendActivity(Messages[locale].will_answer_projector) // TODO: Handle rnd.
|
||||
await step.context.sendActivity(Messages[locale].will_answer_projector) // TODO: Handle rnd.
|
||||
var html = answer.content
|
||||
|
||||
if (answer.format === ".md") {
|
||||
|
@ -370,7 +370,7 @@ export class KBService {
|
|||
})
|
||||
html = marked(answer.content)
|
||||
}
|
||||
await conversationalService.sendEvent(dc, "play",
|
||||
await conversationalService.sendEvent(step, "play",
|
||||
{
|
||||
playerType: "markdown", data: {
|
||||
content: html, answer: answer,
|
||||
|
@ -378,8 +378,8 @@ export class KBService {
|
|||
}
|
||||
})
|
||||
} else {
|
||||
await dc.context.sendActivity(answer.content)
|
||||
await conversationalService.sendEvent(dc, "stop", null)
|
||||
await step.context.sendActivity(answer.content)
|
||||
await conversationalService.sendEvent(step, "stop", null)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ export class GBSecurityPackage implements IGBPackage {
|
|||
unloadBot(min: GBMinInstance): void {
|
||||
|
||||
}
|
||||
onNewSession(min: GBMinInstance, dc: any): void {
|
||||
onNewSession(min: GBMinInstance, step: any): void {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ export class GBWhatsappPackage implements IGBPackage {
|
|||
unloadBot(min: GBMinInstance): void {
|
||||
|
||||
}
|
||||
onNewSession(min: GBMinInstance, dc: any): void {
|
||||
onNewSession(min: GBMinInstance, step: any): void {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ export class GBServer {
|
|||
instances = await core.loadInstances();
|
||||
let instance = instances[0];
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
logger.info(`Updating bots proxies...`);
|
||||
logger.info(`Updating bot endpoint to local reverse proxy (ngrok)...`);
|
||||
|
||||
await azureDeployer.updateBotProxy(
|
||||
instance.botId,
|
||||
|
|
Loading…
Add table
Reference in a new issue