More MS adaptations.
This commit is contained in:
parent
677057c282
commit
8a3c41db1c
5 changed files with 21 additions and 21 deletions
|
@ -55,7 +55,7 @@ export class WelcomeDialog extends IGBDialog {
|
||||||
|
|
||||||
if (!user.once) {
|
if (!user.once) {
|
||||||
user.once = true;
|
user.once = true;
|
||||||
await min.userProfile.set(context, user);
|
await min.userProfile.set(step.context, user);
|
||||||
var a = new Date();
|
var a = new Date();
|
||||||
const date = a.getHours();
|
const date = a.getHours();
|
||||||
var msg =
|
var msg =
|
||||||
|
|
|
@ -323,7 +323,7 @@ export class GBMinService {
|
||||||
min.userProfile = conversationState.createProperty('userProfile');
|
min.userProfile = conversationState.createProperty('userProfile');
|
||||||
const dialogState = conversationState.createProperty('dialogState');
|
const dialogState = conversationState.createProperty('dialogState');
|
||||||
min.dialogs = new DialogSet(dialogState);
|
min.dialogs = new DialogSet(dialogState);
|
||||||
//min.dialogs.add("textPrompt", new TextPrompt());
|
min.dialogs.add("textPrompt", new TextPrompt());
|
||||||
|
|
||||||
return { min, adapter, conversationState };
|
return { min, adapter, conversationState };
|
||||||
}
|
}
|
||||||
|
@ -387,7 +387,7 @@ export class GBMinService {
|
||||||
});
|
});
|
||||||
user.loaded = true;
|
user.loaded = true;
|
||||||
user.subjects = [];
|
user.subjects = [];
|
||||||
await min.userProfile.set(context, user);
|
await min.userProfile.set(step.context, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
|
|
|
@ -54,10 +54,10 @@ export class AskDialog extends IGBDialog {
|
||||||
|
|
||||||
min.dialogs.add(new WaterfallDialog("/answerEvent", [
|
min.dialogs.add(new WaterfallDialog("/answerEvent", [
|
||||||
async step => {
|
async step => {
|
||||||
if (step.result && step.result.questionId) {
|
if (step.options && step.options["questionId"]) {
|
||||||
let question = await service.getQuestionById(
|
let question = await service.getQuestionById(
|
||||||
min.instance.instanceId,
|
min.instance.instanceId,
|
||||||
step.result.questionId
|
step.options["questionId"]
|
||||||
);
|
);
|
||||||
let answer = await service.getAnswerById(
|
let answer = await service.getAnswerById(
|
||||||
min.instance.instanceId,
|
min.instance.instanceId,
|
||||||
|
@ -76,8 +76,8 @@ export class AskDialog extends IGBDialog {
|
||||||
|
|
||||||
min.dialogs.add(new WaterfallDialog("/answer", [
|
min.dialogs.add(new WaterfallDialog("/answer", [
|
||||||
async step => {
|
async step => {
|
||||||
const user = await min.userProfile.get(context, {});
|
const user = await min.userProfile.get(step.context, {});
|
||||||
let text = step.result.query;
|
let text = step.options["query"];
|
||||||
if (!text) {
|
if (!text) {
|
||||||
throw new Error(`/answer being called with no args.query 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.
|
// Handle extra text from FAQ.
|
||||||
|
|
||||||
if (step.result && step.result.query) {
|
if (step.options && step.options["query"]) {
|
||||||
text = step.result.query;
|
text = step.options["query"];
|
||||||
} else if (step.result && step.result.fromFaq) {
|
} else if (step.options && step.options["fromFaq"]) {
|
||||||
await step.context.sendActivity(Messages[locale].going_answer);
|
await step.context.sendActivity(Messages[locale].going_answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ export class AskDialog extends IGBDialog {
|
||||||
// Searches KB for the first time.
|
// Searches KB for the first time.
|
||||||
|
|
||||||
user.lastQuestion = text;
|
user.lastQuestion = text;
|
||||||
await min.userProfile.set(context, user);
|
await min.userProfile.set(step.context, user);
|
||||||
let resultsA = await service.ask(
|
let resultsA = await service.ask(
|
||||||
min.instance,
|
min.instance,
|
||||||
text,
|
text,
|
||||||
|
@ -128,7 +128,7 @@ export class AskDialog extends IGBDialog {
|
||||||
|
|
||||||
user.isAsking = false;
|
user.isAsking = false;
|
||||||
user.lastQuestionId = resultsA.questionId;
|
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.
|
// Sends the answer to all outputs, including projector.
|
||||||
|
|
||||||
|
@ -156,11 +156,11 @@ export class AskDialog extends IGBDialog {
|
||||||
if (resultsB && resultsB.answer) {
|
if (resultsB && resultsB.answer) {
|
||||||
// Saves some context info.
|
// Saves some context info.
|
||||||
|
|
||||||
const user = await min.userProfile.get(context, {});
|
const user = await min.userProfile.get(step.context, {});
|
||||||
|
|
||||||
user.isAsking = false;
|
user.isAsking = false;
|
||||||
user.lastQuestionId = resultsB.questionId;
|
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.
|
// Informs user that a broader search will be used.
|
||||||
|
|
||||||
|
@ -193,18 +193,18 @@ export class AskDialog extends IGBDialog {
|
||||||
min.dialogs.add(new WaterfallDialog("/ask", [
|
min.dialogs.add(new WaterfallDialog("/ask", [
|
||||||
async step => {
|
async step => {
|
||||||
const locale = step.context.activity.locale;
|
const locale = step.context.activity.locale;
|
||||||
const user = await min.userProfile.get(context, {});
|
const user = await min.userProfile.get(step.context, {});
|
||||||
user.isAsking = true;
|
user.isAsking = true;
|
||||||
if (!user.subjects) {
|
if (!user.subjects) {
|
||||||
user.subjects = [];
|
user.subjects = [];
|
||||||
}
|
}
|
||||||
let text = [];
|
let text;
|
||||||
|
|
||||||
// Three forms of asking.
|
// Three forms of asking.
|
||||||
|
|
||||||
if (step.result && step.result.firstTime) {
|
if (step.options && step.options["firstTime"]) {
|
||||||
text = Messages[locale].ask_first_time;
|
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;
|
text = Messages[locale].anything_else;
|
||||||
} else if (user.subjects.length > 0) {
|
} else if (user.subjects.length > 0) {
|
||||||
text = Messages[locale].which_question;
|
text = Messages[locale].which_question;
|
||||||
|
@ -213,7 +213,7 @@ export class AskDialog extends IGBDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (text.length > 0) {
|
if (text.length > 0) {
|
||||||
// TODO: await step.prompt("textPrompt", text:text);
|
await step.prompt("textPrompt", text);
|
||||||
}
|
}
|
||||||
return await step.next();
|
return await step.next();
|
||||||
},
|
},
|
||||||
|
|
|
@ -58,7 +58,7 @@ export class MenuDialog extends IGBDialog {
|
||||||
const locale = step.context.activity.locale;
|
const locale = step.context.activity.locale;
|
||||||
var rootSubjectId = null;
|
var rootSubjectId = null;
|
||||||
|
|
||||||
if (step.result && step.result.data) {
|
if (step.options && step.options["data"]) {
|
||||||
var subject = step.result.data;
|
var subject = step.result.data;
|
||||||
|
|
||||||
// If there is a shortcut specified as subject destination, go there.
|
// If there is a shortcut specified as subject destination, go there.
|
||||||
|
|
|
@ -155,7 +155,7 @@ export class KBService {
|
||||||
instance.searchIndex,
|
instance.searchIndex,
|
||||||
instance.searchIndexer
|
instance.searchIndexer
|
||||||
)
|
)
|
||||||
let results = await service.search(query)
|
let results = await service.search(query)
|
||||||
if (results && results.length > 0 &&
|
if (results && results.length > 0 &&
|
||||||
results[0]["@search.score"] >= searchScore) {
|
results[0]["@search.score"] >= searchScore) {
|
||||||
let value = await this.getAnswerById(
|
let value = await this.getAnswerById(
|
||||||
|
|
Loading…
Add table
Reference in a new issue