fix(basic.gblib): update ChatServices.ts #420

Closed
eltociear wants to merge 2540 commits from patch-1 into main
3 changed files with 10 additions and 8 deletions
Showing only changes of commit c600a91cde - Show all commits

View file

@ -626,7 +626,11 @@ export class GBConversationalService {
}
}
public async routeNLP(step: GBDialogStep, min: GBMinInstance, text: string): Promise<boolean> {
// TODO: Update botlib.
public async routeNLP(step: GBDialogStep, min: GBMinInstance, text: string): Promise<Boolean> {
return false;
}
public async routeNLP2(step: GBDialogStep, min: GBMinInstance, text: string) {
if (min.instance.nlpAppId === null || min.instance.nlpAppId === undefined) {
return false;
}
@ -713,16 +717,14 @@ export class GBConversationalService {
});
}
await step.replaceDialog(`/${intent}`, step.activeDialog.state.options);
return true;
return await step.replaceDialog(`/${intent}`, step.activeDialog.state.options);
}
GBLog.info(
`NLP NOT called: score: ${score} > required (nlpScore): ${instanceScore}`
);
return false;
return null;
}
public async getLanguage(min: GBMinInstance, text: string): Promise<string> {

View file

@ -1242,7 +1242,6 @@ export class GBMinService {
if (step.activeDialog !== undefined) {
await step.continueDialog();
} else {
const startDialog = user.hearOnDialog ?

View file

@ -256,8 +256,9 @@ export class AskDialog extends IGBDialog {
// Tries to answer by NLP.
if (await min.conversationalService.routeNLP(step, min, text)) {
return await step.replaceDialog('/ask', { isReturning: true });
let nextDialog = await min.conversationalService["routeNLP2"](step, min, text);
if (nextDialog) {
return nextDialog;
}
// Tries to answer by Reading Comprehension.