DESCRIPTION OF PROBLEM
using the generated code of virtual assistant, when you start the bot, dispatcher model operates, but it does not guarantees that the qna services are down, so the user does not knows if something is happening with the bot because it does not delivers an answer.
IDEA TO CORRECT THE BEHAVIOR
modify the source code of dialog/mainDialog.ts to control the errors when bot is connecting or not with the qnamaker service
BEFORE:
const answers: QnAMakerResult[] = await qnaService.getAnswers(dc.context);
if (answers !== undefined && answers.length > 0) {
await dc.context.sendActivity(answers[0].answer, answers[0].answer);
} else {
await this.responder.replyWith(dc.context, MainResponses.responseIds.confused);
}
AFTER:
const getAnswer = async (_service: QnAMakerTelemetryClient, context: TurnContext, serviceAvailable: any, serviceError: any) => {
await _service.getAnswers(dc.context)
.then((result)=> serviceAvailable(result))
.catch((error)=>serviceError(error));
};
and
await getAnswer(qnaService,dc.context, async (answers:QnAMakerResult[])=>{
if (answers !== undefined && answers.length > 0) {
await dc.context.sendActivity(answers[0].answer, answers[0].answer);
} else {
await this.responder.replyWith(dc.context, MainResponses.responseIds.confused);
}
}, async (error:Error)=>{
const defaultErrorText = `Error management querying a specific Knowledge base. [kbId:${intent}]`;
await dc.context.sendActivity(defaultErrorText,defaultErrorText);
});
Additionally, if the service === undefined, throw new error swallows the errors with no emulator response. In my case, the general LUIS model was not deployed with the initial setup and I spent about 2 days tracking this down through iterative debugging. Painful experience for someone new to the Framework and it's associated resources (thanks for the work on this though!)
Hi all, we've added this to our backlog. We'll let you know once we start working on the fix.
@batta32 with the latest QnaMaker dialog added to BF 4.7 we've removed this custom code in the template. Could you investigate updating the typescript template to match the latest (next branch) VA and we can then close this.
Sure @darrenj! We identified the PR #2809 which updates the [C#] Virtual Assistant, adding the latest QnAMakerDialog introduced in SDK R7. Can you confirm if that Pull Request contains all the necessary changes to cover this issue?
Correct!
Most helpful comment
Hi all, we've added this to our backlog. We'll let you know once we start working on the fix.