Skip to content

Commit

Permalink
fix(kb.gbapp): Search score now is derived from root.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Jun 4, 2020
1 parent 54ef60b commit b68adc3
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions packages/kb.gbapp/dialogs/AskDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,15 @@ export class AskDialog extends IGBDialog {
}
// Spells check the input text before sending Search or NLP.
const key = min.instance.spellcheckerKey ? minBoot.instance.spellcheckerKey : min.instance.spellcheckerKey;
if ( key) {
if (key) {
const data = await AzureText.getSpelledText(min.instance.spellcheckerKey, text);
if (data !== text) {
GBLog.info(`Spelling corrected: ${data}`);
text = data;
}
}

const searchScore = min.instance.searchScore? min.instance.searchScore: minBoot.instance.searchScore;
const searchScore = min.instance.searchScore ? min.instance.searchScore : minBoot.instance.searchScore;
// Searches KB for the first time.
user.lastQuestion = text;
await min.userProfile.set(step.context, user);
Expand Down Expand Up @@ -227,16 +227,14 @@ export class AskDialog extends IGBDialog {

private static async handleAnswer(service: KBService, min: GBMinInstance, step: any, answer: GuaribasAnswer) {

const urlSufix = 'url:';

if (answer.content.endsWith('.docx')) {
const mainName = answer.content.replace(/\s|\-/gi, '').split('.')[0];
return await GBMinService.callVM(mainName, min, step);
await GBMinService.callVM(mainName, min, step);

} else {
await service.sendAnswer(min, AskDialog.getChannel(step), step, answer);

return await step.replaceDialog('/ask', { isReturning: true });
}
return await step.replaceDialog('/ask', { isReturning: true });

}

Expand Down

0 comments on commit b68adc3

Please sign in to comment.