Microsoft.Bot.Builder.CognitiveServices.QnAMaker.QnAMakerDialog 如何覆盖未找到?
Microsoft.Bot.Builder.CognitiveServices.QnAMaker.QnAMakerDialog How to override not found?
我正在使用 QnAMakerDialog
,但不知道如何覆盖 "not found"。我可以覆盖 RespondFromQnAMakerResultAsync
但是当没有找到答案时不会调用它。我尝试将默认消息设置为 null 或空字符串,但 QnAMakerDialog
在找不到匹配项时自动响应 "No match found!"!
我不想在找不到匹配项时收到消息,因为我只是将消息转发给 LuisDialog
。我该如何停止这条消息!!!
旁注:我知道某个 Gary 人有不同版本的 QnAMakerDialog
可以执行此操作,但我真的很想使用 Microsoft 的标准版本。这可能吗?
"Gary guy" 是 Gary Pretty。他在 QnAMaker
上做得很好,尤其是几天前通过一个包提供对 QnAMaker API v3 的访问,与 QnAMakerDialog
.[=29 相比,它提供了很多新功能=]
对于每一个来到你的问题并寻找类似答案的用户,你绝对应该看看他的包裹:
有了他的包,直接覆盖NoMatchHandler
就大功告成
对于那些不愿意使用third-party包的人,即使你有代码,"official"QnAMakerDialog
来自Microsoft.Bot.Builder.CognitiveServices
包,来源是... 也在 GitHub.
所以如果你查看 QnAMakerDialog.cs
你会发现你需要的一切都在 MessageReceivedAsync
方法中,特别是消息是由这个 line:
发送的
await context.PostAsync(qnaMakerResults.ServiceCfg.DefaultMessage);
你也可以看到:
MessageReceivedAsync
不能轻易覆盖
即使您使用 new
隐藏此方法并复制粘贴除该行之外的所有方法,您也会遇到一些内部属性问题,例如 serviceCfg
,因此可以' 在您自己的命名空间中使用
所以最后一个选择是从 Microsoft Github 的项目中复制所有 QnA 类 只是为了删除这一行...
编辑:
如您在 https://github.com/Microsoft/BotBuilder-CognitiveServices 上所见,围绕此问题有几个未决问题:
- https://github.com/Microsoft/BotBuilder-CognitiveServices/issues/50
- https://github.com/Microsoft/BotBuilder-CognitiveServices/issues/58
- https://github.com/Microsoft/BotBuilder-CognitiveServices/issues/75
我希望包中很快就会有一个集成,因为已经围绕它提供了几个 Pull Request
我正在使用 QnAMakerDialog
,但不知道如何覆盖 "not found"。我可以覆盖 RespondFromQnAMakerResultAsync
但是当没有找到答案时不会调用它。我尝试将默认消息设置为 null 或空字符串,但 QnAMakerDialog
在找不到匹配项时自动响应 "No match found!"!
我不想在找不到匹配项时收到消息,因为我只是将消息转发给 LuisDialog
。我该如何停止这条消息!!!
旁注:我知道某个 Gary 人有不同版本的 QnAMakerDialog
可以执行此操作,但我真的很想使用 Microsoft 的标准版本。这可能吗?
"Gary guy" 是 Gary Pretty。他在 QnAMaker
上做得很好,尤其是几天前通过一个包提供对 QnAMaker API v3 的访问,与 QnAMakerDialog
.[=29 相比,它提供了很多新功能=]
对于每一个来到你的问题并寻找类似答案的用户,你绝对应该看看他的包裹:
有了他的包,直接覆盖NoMatchHandler
就大功告成
对于那些不愿意使用third-party包的人,即使你有代码,"official"QnAMakerDialog
来自Microsoft.Bot.Builder.CognitiveServices
包,来源是... 也在 GitHub.
所以如果你查看 QnAMakerDialog.cs
你会发现你需要的一切都在 MessageReceivedAsync
方法中,特别是消息是由这个 line:
await context.PostAsync(qnaMakerResults.ServiceCfg.DefaultMessage);
你也可以看到:
MessageReceivedAsync
不能轻易覆盖即使您使用
new
隐藏此方法并复制粘贴除该行之外的所有方法,您也会遇到一些内部属性问题,例如serviceCfg
,因此可以' 在您自己的命名空间中使用
所以最后一个选择是从 Microsoft Github 的项目中复制所有 QnA 类 只是为了删除这一行...
编辑:
如您在 https://github.com/Microsoft/BotBuilder-CognitiveServices 上所见,围绕此问题有几个未决问题:
- https://github.com/Microsoft/BotBuilder-CognitiveServices/issues/50
- https://github.com/Microsoft/BotBuilder-CognitiveServices/issues/58
- https://github.com/Microsoft/BotBuilder-CognitiveServices/issues/75
我希望包中很快就会有一个集成,因为已经围绕它提供了几个 Pull Request