LuisIntent 属性未被正确识别

LuisIntent Attribute not being correctly recognised

我正在学习课程 Getting Started with Building Bots on the Microsoft Bot Framework 并使用课程中的一些代码。

当我在机器人模拟器中键入 "Hi" 时,Luis 意识到这是一个问候意图,但是机器人将其捕获为 None 意图并说“对不起,我没有明白你的意思

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

我还没有为 None 意图设置任何话语。

下面显示结果是调试器中的 Greeting Intent:

导出的.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,而 Doc 的教程使用的是 Web App Bot。

这是因为您的意图名称是 "greetingIntent",而在您的代码中,您将其标记为 "greeting"。将您的代码更改为 "greetingIntent",它应该可以工作。