我需要帮助将我的Luis App集成到C#Bot Framework Bot
当我将Luis App添加到我的C#Microsoft Bot Framework聊天机器人并在模拟器中运行时,我得到一个例外。
异常:响应状态代码不表示成功:400(错误请求)。
来自Github上另一位开发人员的调试帖子建议添加域名,我有我的LuisModel(见下文)。这并没有解决问题。
[LuisModel(“”,“”, 域名:“australiaeast.api.cognitive.microsoft.com”,Staging = true)]
单步执行代码,当我调用新的Dialog.RootLuisDialog()时,我的本地人似乎是正确的。这是一个屏幕抓取
消息控制器代码段
public async Task<HttpResponseMessage> Post([FromBody] Activity activity)
{
// check if activity is of type message
if (activity.Type == ActivityTypes.Message)
{
await Conversation.SendAsync(activity, () => new Dialogs.RootLuisDialog());
}
else
{
HandleSystemMessage(activity);
}
var response = Request.CreateResponse(HttpStatusCode.OK);
return response;
}
Luis Dialog Class
namespace HalChatBot.Dialogs
{
[LuisModel("<MyLuisAppID>", "<MyLuisKey>",
domain: "australiaeast.api.cognitive.microsoft.com", Staging = true)]
[Serializable]
public class RootLuisDialog : LuisDialog<object>
{
[LuisIntent("")]
[LuisIntent("None")]
public async Task None(IDialogContext context, LuisResult result)
{
await context.PostAsync("I am the Default intent");
context.Wait(MessageReceived);
}
[LuisIntent("Greeting")]
public async Task Greeting(IDialogContext context, LuisResult result)
{
await context.PostAsync("I am the Greeting intent");
context.Wait(MessageReceived);
}
}
}
答案 0 :(得分:0)
[LuisModel("<MyLuisAppID>", "<MyLuisKey>", domain: "australiaeast.api.cognitive.microsoft.com")]
现在路易斯集成正在发挥作用。