我正在完成课程Getting Started with Building Bots on the Microsoft Bot Framework,并使用该课程中的一些代码。
当我在机器人仿真器中键入“ Hi”时,Luis意识到这是一个问候意图,但是Bot将其视为“无意图”并说:“对不起,我不知道你的意思”
[Serializable]
public class LUISDialog : LuisDialog<BugReport>
{
private readonly BuildFormDelegate<BugReport> NewBugReport;
public LUISDialog(BuildFormDelegate<BugReport> newBugReport)
{
this.NewBugReport = newBugReport;
}
[LuisIntent("Greeting")]
public async Task Greeting(IDialogContext context, LuisResult result)
{
context.Call(new GreetingDialog(), Callback);
}
[LuisIntent("")]
public async Task None(IDialogContext context, LuisResult result)
{
await context.PostAsync("I'm sorry I don't know what you mean.");
context.Wait(MessageReceived);
}
我没有针对“无”意图进行任何陈述。
以下显示结果是调试器中的“问候语”:
导出的.json如下
{
"luis_schema_version": "3.0.0",
"versionId": "0.1",
"name": "sbdbotapp",
"desc": "",
"culture": "en-us",
"intents": [
{
"name": "GreetingIntent"
},
{
"name": "NewBugReportIntent"
},
{
"name": "None"
},
{
"name": "QueryBugType"
}
],
"entities": [
{
"name": "BugType",
"roles": []
}
],
"composites": [],
"closedLists": [],
"patternAnyEntities": [],
"regex_entities": [],
"prebuiltEntities": [
{
"name": "email",
"roles": []
}
],
"model_features": [],
"regex_features": [],
"patterns": [],
"utterances": [
{
"text": "bug report",
"intent": "NewBugReportIntent",
"entities": []
},
{
"text": "can you check whether foo is a bugtype?",
"intent": "QueryBugType",
"entities": [
{
"entity": "BugType",
"startPos": 22,
"endPos": 24
}
]
},
{
"text": "create bug",
"intent": "NewBugReportIntent",
"entities": []
},
{
"text": "good afternoon",
"intent": "GreetingIntent",
"entities": []
},
{
"text": "good evening",
"intent": "GreetingIntent",
"entities": []
},
{
"text": "good morning",
"intent": "GreetingIntent",
"entities": []
},
{
"text": "hello",
"intent": "GreetingIntent",
"entities": []
},
{
"text": "hey",
"intent": "GreetingIntent",
"entities": []
},
{
"text": "hi",
"intent": "GreetingIntent",
"entities": []
},
{
"text": "hi there",
"intent": "GreetingIntent",
"entities": []
},
{
"text": "i have a problem",
"intent": "NewBugReportIntent",
"entities": []
},
{
"text": "is security a bug type?",
"intent": "QueryBugType",
"entities": [
{
"entity": "BugType",
"startPos": 3,
"endPos": 10
}
]
},
{
"text": "something doesnt work",
"intent": "NewBugReportIntent",
"entities": []
},
{
"text": "yo",
"intent": "GreetingIntent",
"entities": []
}
]
}
[更新]
在DFBerry的帮助下,并重新审视了该课程,我发现该课程使用的是SDK,而该文档的教程使用的是Web App Bot。
答案 0 :(得分:1)
这是因为您的意图的名称为“ greetingIntent”,并且在代码中将其标记为“ greeting”。将您的代码更改为“ greetingIntent”,它应该可以工作。