fix(btfmw): new dialog pattern fixing.

This commit is contained in:
Rodrigo Rodriguez (pragmatismo.io) 2018-11-12 13:00:30 -02:00
parent 54b816b3ca
commit bf48d12f76
4 changed files with 14 additions and 14 deletions

View file

@ -55,7 +55,7 @@ export class GBImporter {
localPath: string) {
const packageJson = JSON.parse(
Fs.readFileSync(UrlJoin(localPath, 'package.json'), 'utf8')
fs.readFileSync(UrlJoin(localPath, 'package.json'), 'utf8')
);
const botId = packageJson.botId;
@ -74,10 +74,10 @@ export class GBImporter {
packageJson: any
) {
const settings = JSON.parse(
Fs.readFileSync(UrlJoin(localPath, 'settings.json'), 'utf8')
fs.readFileSync(UrlJoin(localPath, 'settings.json'), 'utf8')
);
const servicesJson = JSON.parse(
Fs.readFileSync(UrlJoin(localPath, 'services.json'), 'utf8')
fs.readFileSync(UrlJoin(localPath, 'services.json'), 'utf8')
);
packageJson = {...packageJson, ...settings, ...servicesJson};

View file

@ -59,10 +59,10 @@ export class AskDialog extends IGBDialog {
min.dialogs.add(
new WaterfallDialog('/answerEvent', [
async step => {
if (step.options && step.options.questionId) {
if (step.options && step.options['questionId']) {
const question = await service.getQuestionById(
min.instance.instanceId,
step.options.questionId
step.options['questionId']
);
const answer = await service.getAnswerById(
min.instance.instanceId,
@ -84,9 +84,9 @@ export class AskDialog extends IGBDialog {
new WaterfallDialog('/answer', [
async step => {
const user = await min.userProfile.get(step.context, {});
let text = step.options.query;
let text = step.options['query'];
if (!text) {
throw new Error(`/answer being called with no args.query text.`);
throw new Error(`/answer being called with no args query text.`);
}
const locale = step.context.activity.locale;
@ -97,9 +97,9 @@ export class AskDialog extends IGBDialog {
// Handle extra text from FAQ.
if (step.options && step.options.query) {
text = step.options.query;
} else if (step.options && step.options.fromFaq) {
if (step.options && step.options['query']) {
text = step.options['query'];
} else if (step.options && step.options['fromFaq']) {
await step.context.sendActivity(Messages[locale].going_answer);
}
@ -212,9 +212,9 @@ export class AskDialog extends IGBDialog {
// Three forms of asking.
if (step.options && step.options.firstTime) {
if (step.options && step.options['firstTime'] ) {
text = Messages[locale].ask_first_time;
} else if (step.options && step.options.isReturning) {
} else if (step.options && step.options['isReturning'] ) {
text = Messages[locale].anything_else;
} else if (user.subjects.length > 0) {
text = Messages[locale].which_question;

View file

@ -63,7 +63,7 @@ export class MenuDialog extends IGBDialog {
const locale = step.context.activity.locale;
let rootSubjectId = null;
if (step.options && step.options.data) {
if (step.options && step.options['data']) {
const subject = step.result.data;
// If there is a shortcut specified as subject destination, go there.

View file

@ -210,7 +210,7 @@ export class KBService {
public async getFaqBySubjectArray(from: string, subjects: any): Promise<GuaribasQuestion[]> {
const where = {
from: from
from: from, subject1: null, subject2: null, subject3: null, subject4:null
};
if (subjects) {