2
votes

I'm using a TextPrompt in a waterfall dialog (Microsoft Bot Framework v4, node.js) to ask a user a question. I see in the emulator that Luis Trace is returning a recognizerResult which contains the top-scoring intent, but how do I access it and act upon it?

Example steps:

async askAQuestionStep(step) {
  return await step.prompt(MYQUESTION_PROMPT, {
    prompt: 'How are you feeling?'
  });
}
async getAnAnswerStep(step) {
  if (step.result) {
    if (topScoringIntent === 'Good') {
      await step.context.sendActivity("Good to hear.");
  } else {
    return await step.next();
  }
}  

Need to figure out how to actually access "topScoringIntent." The example show how to do this, but I'm getting this error:

[onTurnError]: TypeError: Cannot read property 'recognize' of undefined

I'm not calling this from bot.js, but from its own dialog/file.

1
have you tried setting a breakpoint and seeing what is being returned? - Steven Kanberg
I'm trying to follow the example link but I'm getting this error: "[onTurnError]: TypeError: Cannot read property 'recognize' of undefined" -- I'm also calling this in a separate dialog/file, not from bot.js. - Robbie

1 Answers

0
votes

See this answer: Getting the Luis "topIntent" from a child dialog inside another file (Node.js)

I had to create a luisRecognizer in the dialog file and then pass the botConfig, userSate and conversationState to the dialog.