【问题标题】:How do I get a Luis top-scoring intent from a TextPrompt in a Waterfall (Bot Framework v4)如何从瀑布中的 TextPrompt 获得 Luis 得分最高的意图(Bot Framework v4)
【发布时间】:2018-11-10 10:00:45
【问题描述】:

我在瀑布对话框(Microsoft Bot Framework v4,node.js)中使用 TextPrompt 向用户提问。我在模拟器中看到 Luis Trace 正在返回一个识别器结果,其中包含得分最高的意图,但我如何访问它并对其采取行动?

示例步骤:

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();
  }
}  

需要弄清楚如何实际访问“topScoringIntent”。 example 显示如何执行此操作,但我收到此错误:

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

我不是从 bot.js 调用它,而是从它自己的对话框/文件调用它。

【问题讨论】:

  • 您是否尝试过设置断点并查看返回的内容?
  • 我正在尝试遵循示例 link 但我收到此错误:“[onTurnError]: TypeError: Cannot read property 'recognize' of undefined”——我也在打电话这在一个单独的对话框/文件中,而不是来自 bot.js。

标签: botframework


【解决方案1】:

看到这个答案:Getting the Luis "topIntent" from a child dialog inside another file (Node.js)

我必须在对话框文件中创建一个 luisRecognizer,然后将 botConfig、userSate 和 conversationState 传递给对话框。

【讨论】:

  • 这种方法对我的特定机器人的副产品:它对 Luis 端点进行两次调用:第一个来自 bot.js,第二个来自子对话框——每次我得到“topIntent”来自子对话框。
猜你喜欢
  • 2017-07-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-11-22
相关资源
最近更新 更多