这是我试图将我的机器人加载到机器人框架仿真器中时的当前屏幕:

这是我在我的机器人设置中输入的内容:

但是由于某些原因,我的机器人框架仿真器仍然是空的。我还尝试将Endpoint URL设置为http://localhost:3979/api/messages,但没有成功。我正试着在本地的visual studio上运行它。
这方面的任何帮助都是非常感谢的!
发布于 2018-07-05 23:57:20
L.full,如果您遵循了instructions from the Azure portal to create a QnA bot from a template,则需要对代码进行一些调整,使其在本地工作,进而在模拟器中工作。
使用模板创建机器人后(听起来像你已经完成了),在ABS中,转到Build (在bot Management下)> "Download zip file",您将在本地获得项目的副本。
如果你看一下模板机器人代码,它可以在Azure中工作,因为总的来说,它是从Azure门户内的应用程序设置中访问你的QnA凭据,但在本地,你需要将凭据放在像.config文件这样的地方。
最终,我们现在要做的是将您的QnA凭证插入到项目的.config文件中,因为当您下载压缩包时,该文件不会自动下载到代码中。
下面我只是使用你可以在Azure门户中找到的QnA模板机器人(创建资源> AI +机器学习>网络应用程序机器人和机器人模板“问答”)
使用
在根对话框中
private async Task MessageReceivedAsync(IDialogContext context, IAwaitable<IMessageActivity> result)
{
var message = await result as Activity;
// OLD
//var qnaAuthKey = GetSetting("QnAAuthKey");
//var qnaKBId = Utils.GetAppSetting("QnAKnowledgebaseId");
//var endpointHostName = Utils.GetAppSetting("QnAEndpointHostName");
// NEW
var qnaAuthKey = ConfigurationManager.AppSettings["QnAAuthKey"];
var qnaKBId = ConfigurationManager.AppSettings["QnAKnowledgebaseId"];
var endpointHostName = ConfigurationManager.AppSettings["QnAEndpointHostName"];
// QnA Subscription Key and KnowledgeBase Id null verification
if (!string.IsNullOrEmpty(qnaAuthKey) && !string.IsNullOrEmpty(qnaKBId))
{
// Forward to the appropriate Dialog based on whether the endpoint hostname is present
if (string.IsNullOrEmpty(endpointHostName))
await context.Forward(new BasicQnAMakerPreviewDialog(), AfterAnswerAsync, message, CancellationToken.None);
else
await context.Forward(new BasicQnAMakerDialog(), AfterAnswerAsync, message, CancellationToken.None);
}
else
{
await context.PostAsync("Please set QnAKnowledgebaseId, QnAAuthKey and QnAEndpointHostName (if applicable) in App Settings. Learn how to get them at https://aka.ms/qnaabssetup.");
}
}对于根用户调用的子对话框(例如BasicQnAMakerDialog),请确保还使用ConfigurationManager.AppSettings"KeyName".替换任何需要QnA键的内容
例如在BasicQnAMakerDialog中:
[Serializable]
public class BasicQnAMakerDialog : QnAMakerDialog
{
static readonly string qnaAuthKey = ConfigurationManager.AppSettings["QnAAuthKey"];
static readonly string qnaKBId = ConfigurationManager.AppSettings["QnAKnowledgebaseId"];
static readonly string endpointHostName = ConfigurationManager.AppSettings["QnAEndpointHostName"];
public BasicQnAMakerDialog() : base(new QnAMakerService(
new QnAMakerAttribute
(
qnaAuthKey,
qnaKBId,
"No good match in FAQ.",
0.5,
1,
endpointHostName
)))
{
}
}发布于 2020-05-02 22:05:57
您可以做的一个可能的解决方案是:
注意:这并不意味着它可以100%工作,但这是我遇到的解决方案之一。我也有同样的问题,我用同样的方法解决了它。
希望这能有所帮助。
https://stackoverflow.com/questions/51186403
复制相似问题