diff --git a/packages/core.gbapp/dialogs/WelcomeDialog.ts b/packages/core.gbapp/dialogs/WelcomeDialog.ts index 683b1511..fc126c0c 100644 --- a/packages/core.gbapp/dialogs/WelcomeDialog.ts +++ b/packages/core.gbapp/dialogs/WelcomeDialog.ts @@ -55,7 +55,7 @@ export class WelcomeDialog extends IGBDialog { if (!user.once) { user.once = true; - await min.userProfile.set(context, user); + await min.userProfile.set(step.context, user); var a = new Date(); const date = a.getHours(); var msg = diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index 2c7f7b06..ed7602d8 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -323,7 +323,7 @@ export class GBMinService { min.userProfile = conversationState.createProperty('userProfile'); const dialogState = conversationState.createProperty('dialogState'); min.dialogs = new DialogSet(dialogState); - //min.dialogs.add("textPrompt", new TextPrompt()); + min.dialogs.add("textPrompt", new TextPrompt()); return { min, adapter, conversationState }; } @@ -387,7 +387,7 @@ export class GBMinService { }); user.loaded = true; user.subjects = []; - await min.userProfile.set(context, user); + await min.userProfile.set(step.context, user); } logger.info( diff --git a/packages/kb.gbapp/dialogs/AskDialog.ts b/packages/kb.gbapp/dialogs/AskDialog.ts index 61f5c9cd..cf55db18 100644 --- a/packages/kb.gbapp/dialogs/AskDialog.ts +++ b/packages/kb.gbapp/dialogs/AskDialog.ts @@ -54,10 +54,10 @@ export class AskDialog extends IGBDialog { min.dialogs.add(new WaterfallDialog("/answerEvent", [ async step => { - if (step.result && step.result.questionId) { + if (step.options && step.options["questionId"]) { let question = await service.getQuestionById( min.instance.instanceId, - step.result.questionId + step.options["questionId"] ); let answer = await service.getAnswerById( min.instance.instanceId, @@ -76,8 +76,8 @@ export class AskDialog extends IGBDialog { min.dialogs.add(new WaterfallDialog("/answer", [ async step => { - const user = await min.userProfile.get(context, {}); - let text = step.result.query; + const user = await min.userProfile.get(step.context, {}); + let text = step.options["query"]; if (!text) { throw new Error(`/answer being called with no args.query text.`); } @@ -90,9 +90,9 @@ export class AskDialog extends IGBDialog { // Handle extra text from FAQ. - if (step.result && step.result.query) { - text = step.result.query; - } else if (step.result && step.result.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); } @@ -113,7 +113,7 @@ export class AskDialog extends IGBDialog { // Searches KB for the first time. user.lastQuestion = text; - await min.userProfile.set(context, user); + await min.userProfile.set(step.context, user); let resultsA = await service.ask( min.instance, text, @@ -128,7 +128,7 @@ export class AskDialog extends IGBDialog { user.isAsking = false; user.lastQuestionId = resultsA.questionId; - await min.userProfile.set(context, user); + await min.userProfile.set(step.context, user); // Sends the answer to all outputs, including projector. @@ -156,11 +156,11 @@ export class AskDialog extends IGBDialog { if (resultsB && resultsB.answer) { // Saves some context info. - const user = await min.userProfile.get(context, {}); + const user = await min.userProfile.get(step.context, {}); user.isAsking = false; user.lastQuestionId = resultsB.questionId; - await min.userProfile.set(context, user); + await min.userProfile.set(step.context, user); // Informs user that a broader search will be used. @@ -193,18 +193,18 @@ export class AskDialog extends IGBDialog { min.dialogs.add(new WaterfallDialog("/ask", [ async step => { const locale = step.context.activity.locale; - const user = await min.userProfile.get(context, {}); + const user = await min.userProfile.get(step.context, {}); user.isAsking = true; if (!user.subjects) { user.subjects = []; } - let text = []; + let text; // Three forms of asking. - if (step.result && step.result.firstTime) { + if (step.options && step.options["firstTime"]) { text = Messages[locale].ask_first_time; - } else if (step.result && step.result.isReturning) { + } else if (step.options && step.options["isReturning"]) { text = Messages[locale].anything_else; } else if (user.subjects.length > 0) { text = Messages[locale].which_question; @@ -213,7 +213,7 @@ export class AskDialog extends IGBDialog { } if (text.length > 0) { - // TODO: await step.prompt("textPrompt", text:text); + await step.prompt("textPrompt", text); } return await step.next(); }, diff --git a/packages/kb.gbapp/dialogs/MenuDialog.ts b/packages/kb.gbapp/dialogs/MenuDialog.ts index a9981961..95797f93 100644 --- a/packages/kb.gbapp/dialogs/MenuDialog.ts +++ b/packages/kb.gbapp/dialogs/MenuDialog.ts @@ -58,7 +58,7 @@ export class MenuDialog extends IGBDialog { const locale = step.context.activity.locale; var rootSubjectId = null; - if (step.result && step.result.data) { + if (step.options && step.options["data"]) { var subject = step.result.data; // If there is a shortcut specified as subject destination, go there. diff --git a/packages/kb.gbapp/services/KBService.ts b/packages/kb.gbapp/services/KBService.ts index ad333832..2253a0bb 100644 --- a/packages/kb.gbapp/services/KBService.ts +++ b/packages/kb.gbapp/services/KBService.ts @@ -155,7 +155,7 @@ export class KBService { instance.searchIndex, instance.searchIndexer ) - let results = await service.search(query) + let results = await service.search(query) if (results && results.length > 0 && results[0]["@search.score"] >= searchScore) { let value = await this.getAnswerById(