【发布时间】:2018-06-17 05:55:29
【问题描述】:
使用提琴手,我可以看到当查询传递到我的机器人应用程序时,LUIS 正在返回正确的 JSON 对象。它甚至包括列出的正确实体和意图。但是,我的班级必须设置错误,因为我在每次调用时都会收到 InvalidIntentHandlerException,这会阻止我向用户发送消息。我的意图根据我在 LUIS 中看到的内容按原样命名,所以我不知道什么被认为是无效的。
结构如下:
namespace BotApplication1.Dialogs
{
[LuisModel("value...", "value...",)] //removed, but valid in the code as Fiddler shows this results in the proper endpoint
[Serializable]
public class MyDialog : LuisDialog<object> //also tried LuisDialog<string>
{
[LuisIntent("None")]
public async Task None(IDialogContext context, LuisServiceResult result) // I also tried LuisResult instead of LuisServiceResult on a whim. No difference.
{
await context.PostAsync("I don't understand.");
await Task.Delay(1000);
await context.PostAsync("What were you saying?");
}
[LuisIntent("MessageDelete")]
public async Task MessageDelete(IDialogContext context, LuisServiceResult result)
{
await context.PostAsync($"Message deleted!");
}
}
}
调试输出:
Exception thrown: 'Microsoft.Bot.Builder.Dialogs.InvalidIntentHandlerException' in mscorlib.dll
Error: None //the error returned to the MessageController by the LuisDialog class. It shows "None" even when I can see that LUIS returned a valid intent other than "None"
编辑:另外,我在输出中看到了这一点,但我不确定它是否重要:Service url localhost:6986 is not trusted and JwtToken cannot be sent to it.
这与应用程序连接的端口不同。
【问题讨论】:
-
你使用的是什么版本的机器人框架?
-
3.15.2.2(我相信是最新的稳定版)
-
您只为 1 个意图训练过它?还是你训练的意图不在代码中?
-
在
[LuisIntent("None")]上方添加[LuisIntent("")],看看是否有效,这将有助于我们了解您是否没有在代码中添加Luis意图 -
我只训练了 2 个意图,但两者都在代码中。我什至删除了我所有的意图,除了那里列出的那个。
标签: c# visual-studio-2017 artificial-intelligence botframework azure-language-understanding