在 QnA maker 中更改答案布局

Change the answer Layout in QnA maker

请问如何在结果为多选时更改QnA Maker的布局? 例如,使用 Hero Card 更改为 Carousel Layout?

谢谢。

使用您引用的 v3 QnAMaker 包,您应该能够自己控制响应的类型和格式。添加您认为合适的许多答案作为附件并将附件类型设置为 Carousel。

您可以覆盖 returns QnAMakerDialog 中对用户的响应的方法,如下所示;

protected override async Task RespondFromQnAMakerResultAsync(IDialogContext context, IMessageActivity message, QnAMakerResults results)
        {
            if (results.Answers.Count > 0)
            {
                // build your response here adding card attachment for each answer
                // and set attachment type to carusel
                await context.PostAsync(response);
            }
        }