1

我正在使用机器人框架自适应对话框。我在通过使用识别器读取 luis 数据来获取意图和解析实体时遇到问题。只有通过在子自适应对话框中阅读“turn.recognized”才能获得响应中得分最高的意图。我已将我的 luis 迁移到 v3 并在调用 luis 时将 IncludeAllIntents 属性设置为 true。我错过了在 LuisAdaptiveRecognizer 中设置任何属性吗?谁能帮我解决这个问题,因为我有一个场景来检查机器人中第二个得分最高的意图。这是自适应对话的问题吗?

我使用 Ms docs 来构建机器人自适应对话框。

还有一件事有没有办法从 turn.recognized 的结果中提取 luis 解析的实体作为 RecognizerResult 类型。

根对话框:

var rootDialog = new AdaptiveDialog(nameof(AdaptiveDialog))
{
    Recognizer = new LuisAdaptiveRecognizer()
    {
        ApplicationId = Configuration["LuisAppId"],
        EndpointKey = Configuration["LuisAPIKey"],
        Endpoint = Configuration["LuisAPIHostName"],
        PredictionOptions = new Microsoft.Bot.Builder.AI.LuisV3.LuisPredictionOptions
        {
            IncludeAllIntents = true,
            IncludeInstanceData = true,
            IncludeAPIResults = true,
            PreferExternalEntities = true,
            Slot = "producton"
        }
    },
    Triggers = new List<OnCondition>()
    {
         new OnIntent("Greetings")
        {
            Actions = new List<Dialog>()
            {
                new SendActivity("${HelpRootDialog()}")
            }
        },
    },

子对话框:

public FindLinks(IConfiguration configuration) : base(nameof(FindLinks))
{
    _configuration = configuration;
    this.LinksDialog = new AdaptiveDialog(nameof(FindLinks))
    {
        Triggers = new List<OnCondition>()
        {
            new OnBeginDialog()
            {
                Actions = new List<Dialog>()
                    {
                        new CodeAction(ResolveAndSendAnswer)
                    }
            },
        }
    };

    AddDialog(this._findLinksDialog);
    InitialDialogId = nameof(FindLinks);
}

private async Task<DialogTurnResult> ResolveAndSendAnswer(DialogContext dialogContext, System.Object options)
{
    JObject jObject;
    IList<string> queries = new List<string>();
    dialogContext.State.TryGetValue("turn.recognized", out jObject);

    ....This is how i resolved the luis data from the turn.
}
4

1 回答 1

1

turn.recognized不幸的是,无论您使用哪种识别器,自适应对话框都被设计为仅包含一个意图。您可以在此处的源代码中看到:

result.Intents.Clear();
result.Intents.Add(topIntent, topScore);

看起来其他意图可以访问的唯一位置是在您的遥测中。所以你有几个选择,虽然我知道它们并不理想。

  1. 显式调用 LUIS 端点,而不是依赖LuisAdaptiveRecognizer. 这可以使用 HTTP 请求作为自适应对话框内的操作来完成,也可以在对话框外完成。
  2. 从记录的遥测中加载额外的意图。如果您制作了一个自定义遥测客户端,使数据在您的机器人的本地内存中可用,这可能是最简单的。
  3. 在 GitHub 上提出功能请求,要求他们在自适应对话框中提供所有意图:https ://github.com/microsoft/botbuilder-dotnet/issues/new/choose
于 2020-07-27T21:03:46.923 回答