Azure虚拟助手提示按钮 [英] Azure virtual assistant prompt buttons

查看:43
本文介绍了Azure虚拟助手提示按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了Microsoft Azure虚拟助手,但是没有连接到Luis并且尚未部署.

I have a Microsoft azure virtual assistant set up but without connecting to Luis and not deployed yet.

在qnamaker网站上,它成功执行了多轮跟进按钮,但在机器人模拟器上却没有.

In qnamaker website, it was successfully doing multi-turn follow up buttons but not on the bot emulator.

我想知道这是否是由于没有首先设置和部署虚拟助手引起的.因为创建虚拟助手时默认贺卡甚至无法显示.

I was wondering if this was caused by not set up and deploy the virtual assistant in the first place. Because the default greeting card was even failed to show when the virtual assistant was created.

我是否缺少一些代码来显示这些跟进提示按钮,或者因为Luis未连接且部署未设置而不可能吗?如果我缺少一些代码,可以有人指出我正确的方向吗?

Am I missing some code to display those follow up prompt buttons or is it impossible because Luis is not connected and deployment not set up? If I am missing some code can someone point me to right direction?

注意:这是虚拟助手,而不是机器人.它们很相似,但是针对机器人的教程在虚拟助手上不起作用.我正在使用最新的虚拟助手模板.我做了很多研究,但无法解决.我已经花了2天的时间了.

Note: this is a virtual assistant and not a bot. They are similiar but the tutorial for bots didn't work on the virtual assistant. I'm using the latest virtual assistant template. I did a lot of research but couldn't solve it. I have been spending 2 days on this.

谢谢

推荐答案

多转功能是可以在门户qnamaker.ai中启用的功能,但是您的机器人仍然负责处理发送带有卡的消息并附有按钮.

The multi-turn feature is a feature that can be turned on in the portal qnamaker.ai, however your bot is still responsible for handling sending messages that have cards with buttons attached.

  • 因此,在门户中启用多转会允许您调用 generateanswer API,以返回带有" context "对象的响应,该对象包括 prompts 值.
  • 第2步是确保您的助手具有创建卡的代码.您需要在何时生成卡片时进行处理
  • So enabling multi-turn in the portal will allow for your call to the generateanswer API to return responses with a "context" object that includes prompts values.
  • Step 2 is to ensure your assistant has the code to create cards. You must handle when you want cards to be generated

您可以在 botbuilder示例存储库

You can find an example of a bot implementing multi-turn prompts in the botbuilder samples repo, 70.qnamaker-multiturn-sample. The snippet where it builds the card, I'll post below, but I would advise going to the sample directly to look at the logic around it, to get an idea of when you want to actually send a message with a card (they do it by sending cards only if context and prompt are present--you can customize it to how you need for your bot).

        /// <summary>
        /// Get multi-turn prompts card.
        /// </summary>
        /// <param name="result">Result to be dispalyed as prompts.</param>
        /// <returns>IMessageActivity.</returns>
        private static IMessageActivity GetQnAPromptsCardWithoutNoMatch(QueryResult result)
        {
            if (result == null)
            {
                throw new ArgumentNullException(nameof(result));
            }

            var chatActivity = Activity.CreateMessageActivity();
            chatActivity.Text = result.Answer;
            var buttonList = new List<CardAction>();

            // Add all prompt
            foreach (var prompt in result.Context.Prompts)
            {
                buttonList.Add(
                    new CardAction()
                    {
                        Value = prompt.DisplayText,
                        Type = "imBack",
                        Title = prompt.DisplayText,
                    });
            }

            var plCard = new HeroCard()
            {
                Buttons = buttonList
            };

            // Create the attachment.
            var attachment = plCard.ToAttachment();

            chatActivity.Attachments.Add(attachment);

            return chatActivity;
        }

我已经有一段时间没有看过Virtual Assistant解决方案项目了,但是我要说一下以确保他们没有多轮QnA对话框,以验证这是问题所在,如果是的话,请查看多轮回qna示例,以获取一个示例,说明如何编辑VA以包括处理多轮回合提示.

I haven't looked at the Virtual Assistant solutions project in a while, but I would say check to make sure that they don't have a multi-turn QnA dialog already to verify that this is the issue, and if so, look at the multi-turn qna sample to see an example of how you can edit your VA to include handling multi-turn prompts.

这篇关于Azure虚拟助手提示按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆