属性"luismodel"在此声明类型上无效

属性

问题描述:

我正在尝试使用botbuilder Botframework完成一个非常基本的机器人.问题是luis.ai集成.我已经将luis.ai与.js文件一起使用,但是当我尝试从c#项目进行引用时,标题出现错误.

I am trying to get a pretty basic bot done using the botbuilder Botframework. the problem is luis.ai integration. I have used the luis.ai with a .js file but when I am trying to reference from my c# project, I am getting the error in the title.

using System;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
// using System.Web.Http;
// using System.Web.Http.Description;
// using System.Collections.Generic;
// using Microsoft.Bot.Connector;
using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Builder.Luis;
using Microsoft.Bot.Builder.Luis.Models;
// using Newtonsoft.Json;


namespace MyBot
{
    [LuisModel("80ba6a3b-8f62-47e6-81d0-350211b85580", "9b593fab21d54a328c0b9aeb0a64138b")]

    [LuisIntent("")]
    public async Task None(IDialogContext context, LuisResult result)
    {
        string message = "I'm sorry I didn't understand. Try asking about your bill.";
        await context.PostAsync(message);
        context.Wait(MessageReceived);
    }

    [LuisIntent("NextInvoiceDate")]
    public async Task NextInvoiceDate(IDialogContext context, LuisResult result)
    {
        string message = "Your next payment will go out on the 17th of the month.";
        await context.PostAsync(message);
        context.Wait(MessageReceived);
    }
}

这看起来像在我可以找到的示例代码中使用lusimodel的方式,所以我不确定为什么它在这里不起作用.我只是想与C#接触,所以我有点迷路.

That looks like the way that lusimodel is used in the sample code I can find so I am not sure why it doesn't work here. I am just trying to get to grips with c# so I am a bit lost.

您可能错过了类声明.

尝试

namespace MyBot
{
    [LuisModel("80ba6a3b-8f62-47e6-81d0-350211b85580", "9b593fab21d54a328c0b9aeb0a64138b")]
    public MyBotClass
    {
        [LuisIntent("")]
        public async Task None(IDialogContext context, LuisResult result)
        {
            string message = "I'm sorry I didn't understand. Try asking about your bill.";
            await context.PostAsync(message);
            context.Wait(MessageReceived);
        }

        [LuisIntent("NextInvoiceDate")]
        public async Task NextInvoiceDate(IDialogContext context, LuisResult result)
        {
            string message = "Your next payment will go out on the 17th of the month.";
            await context.PostAsync(message);
            context.Wait(MessageReceived);
        }
    }
}