我正在使用BotFrameworkSDKV-4并尝试使用QnAMakerService。
我有BotService.cs,其中有QnAMakerService实例。在启动QnAMakerService时,我在Visual诊断窗口中得到一个错误:
无法加载类型的Microsoft.Bot.Builder.Internals.Fibers.SetField
下面是我的密码。我已经评论了我得到错误的那一行:
public BotServices(BotConfiguration botConfiguration)
{
foreach (var service in botConfiguration.Services)
{
switch (service.Type)
{
case ServiceTypes.QnA:
{
var qna = (Microsoft.Bot.Configuration.QnAMakerService)service;
if (qna == null)
{
throw new InvalidOperationException("The QnA service is not configured correctly in your '.bot' file.");
}
if (string.IsNullOrWhiteSpace(qna.KbId))
{
throw new InvalidOperationException("The QnA KnowledgeBaseId ('kbId') is required to run this sample. Please update your '.bot' file.");
}
if (string.IsNullOrWhiteSpace(qna.EndpointKey))
{
throw new InvalidOperationException("The QnA EndpointKey ('endpointKey') is required to run this sample. Please update your '.bot' file.");
}
if (string.IsNullOrWhiteSpace(qna.Hostname))
{
throw new InvalidOperationException("The QnA Host ('hostname') is required to run this sample. Please update your '.bot' file.");
}
string defaultMessage = "Sorry no answer found.";
QnAMakerAttribute qnAMakerAttribute = new QnAMakerAttribute(qna.EndpointKey, qna.KbId, defaultMessage, 40, 5, <end_point>);
var qnaMakerService = new Microsoft.Bot.Builder.CognitiveServices.QnAMaker.QnAMakerService(qnAMakerAttribute); // Error is here
qnaMakerServices.Add(qna.Name, qnaMakerService);
break;
}
}
}
}早些时候,我在同一个端点上使用了本机Http调用,并且运行良好。知道我做错了什么吗?
发布于 2019-02-21 17:20:40
@SouvikGhosh Daniel是正确的,这里的依赖版本不匹配。
正如您在微软文档中看到的那样,Fiber类应用于Microsoft.Bot.Builder v3。
QnAMaker在v4中需要的是Microsoft.Bot.Builder.AI.QnA for C#:https://github.com/Microsoft/botbuilder-dotnet/tree/master/libraries/Microsoft.Bot.Builder.AI.QnA
博士只需确保您只有v4依赖关系,而不是v3和v4的混合。
https://stackoverflow.com/questions/54807951
复制相似问题