我有以下代码,但来自 Microsoft bot 创建教程https://docs.microsoft.com/en-us/azure/bot-service/dotnet/bot-builder-dotnet-quickstart
当我复制并粘贴它时,我的 using 语句似乎没有在示例中被使用?我已经尝试添加它建议的 using 语句,但我认为这不是必需的。我有错误[BotAuthentication]和Activity“找不到类型或命名空间名称‘活动’”等
我也安装了金块包。
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;
using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Connector;
using System;
using System.Linq;
using System.Configuration;
using Microsoft.Bot.Builder.CognitiveServices.QnAMaker;
using System.Web.Services.Description;
using Microsoft.Bot.Builder.PersonalityChat;
using Microsoft.Bot.Builder.PersonalityChat.Core;
namespace BenTestBot
{
[BotAuthentication]
public class MessagesController : ApiController
{
public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
{
if (activity.GetActivityType() == ActivityTypes.Message)
{
//await Conversation.SendAsync(activity, () => new Qna_Rich_Cards.Dialogs.QnaDialog().DefaultIfException());
await Conversation.SendAsync(activity, () => new Dialogs.BasicPersonalityChatBotDialog().DefaultIfException());
}
else
{
await HandleSystemMessageAsync(activity);
}
var response = Request.CreateResponse(HttpStatusCode.OK);
return response;
}
慕村225694
相关分类