我在Azure中创建了一个机器人并将其下载下来。LUIS的免费1000次调用已经达到了限制。我在Azure门户中创建了一个订阅(我确实做了Docker容器之类的东西)。按照此指南执行步骤6时,当我在浏览器中单击终结点URL并直接查询时,它可以正常工作。
我通过Bot Emulator将其添加到机器人中,方法是在服务中点击+号并添加机器人模型。但是当我运行机器人时,出现标题错误。我注意到在.bot文件中,机器人模拟器添加的授权密钥和订阅密钥是相同的。
因此,我将订阅密钥更改为Azure生成的密钥之一,但仍然出现相同的错误。我尝试重置授权密钥仍然出现相同的问题,并删除了我的luis.ai帐户并创建了一个新帐户(邮箱地址仍相同,因为这是登录Azure门户的邮箱),但仍然相同。
以下是一些参考图片和错误信息。
我还尝试在luis.ai中进行测试,并得到了这个结果。
但是当我检查时,它设置为新资源。
这是通过Bot模拟器添加Luis后的bot文件图片。它具有相同的授权密钥和订阅密钥(仍然被禁止)。
因此,我将其更改为订阅密钥(仍然被禁止)。
在直接在URL中进行测试时,它可以正常工作。
供参考:
Azure门户
luis.ai
我通过Bot Emulator将其添加到机器人中,方法是在服务中点击+号并添加机器人模型。但是当我运行机器人时,出现标题错误。我注意到在.bot文件中,机器人模拟器添加的授权密钥和订阅密钥是相同的。
因此,我将订阅密钥更改为Azure生成的密钥之一,但仍然出现相同的错误。我尝试重置授权密钥仍然出现相同的问题,并删除了我的luis.ai帐户并创建了一个新帐户(邮箱地址仍相同,因为这是登录Azure门户的邮箱),但仍然相同。
以下是一些参考图片和错误信息。
我还尝试在luis.ai中进行测试,并得到了这个结果。
![enter image description here](https://istack.dev59.com/jXDWZ.webp)
![enter image description here](https://istack.dev59.com/zhAJH.webp)
![enter image description here](https://istack.dev59.com/HzDis.webp)
![enter image description here](https://istack.dev59.com/E50bv.webp)
![enter image description here](https://istack.dev59.com/S11dt.webp)
![enter image description here](https://istack.dev59.com/grMiF.webp)
![enter image description here](https://istack.dev59.com/gzNUf.webp)
这里是机器人服务的代码。
using System;
using System.Collections.Generic;
using Microsoft.Bot.Builder.AI.Luis;
using Microsoft.Bot.Configuration;
namespace Microsoft.BotBuilderSamples
{
public class BotServices
{
public BotServices(BotConfiguration botConfiguration)
{
foreach (var service in botConfiguration.Services)
{
switch (service.Type)
{
case ServiceTypes.Luis:
{
var luis = (LuisService)service;
if (luis == null)
{
throw new InvalidOperationException("The LUIS service is not configured correctly in your '.bot' file.");
}
var endpoint = (luis.Region?.StartsWith("https://") ?? false) ? luis.Region : luis.GetEndpoint();
var app = new LuisApplication(luis.AppId, luis.AuthoringKey, endpoint);
var recognizer = new LuisRecognizer(app);
this.LuisServices.Add(luis.Name, recognizer);
break;
}
}
}
}
public Dictionary<string, LuisRecognizer> LuisServices { get; } = new Dictionary<string, LuisRecognizer>();
}
}
我已经尝试解决这个问题4天了。谢谢!
LuisApplication
的代码吗?你可以在这里找到一个例子。 - Mick12ccc
或b575
开头的终端点密钥。根本不要使用以ad9c
开头的创作密钥。你还是遇到了403错误吗? - mdrichardson.bot
文件中更新密钥。在LUIS条目中,它正在使用你的authoringKey
(ad9c...
),而应该使用你的一个endpointKey
(12ccc...
或b575...
)。请在你的.bot
文件中替换它们,然后告诉我结果如何。 - mdrichardson