Botframework Azure机器人程序框架:如何让自适应卡在团队中工作?

Botframework Azure机器人程序框架:如何让自适应卡在团队中工作?,botframework,azure-bot-service,adaptive-cards,microsoft-bot-framework,Botframework,Azure Bot Service,Adaptive Cards,Microsoft Bot Framework,我正在尝试使用Microsoft bot框架创建Azure托管的bot。我在机器人模拟器中一切正常,但当我将机器人部署到团队并尝试与之通信时,我遇到了麻烦。我可以向机器人发送消息,并让它回复我,但这是我所能做到的。 本质上,我只想让用户看到一个问题和四个选项,让他们能够点击一个选项。例如,如果用户看到“进行选择”,他们应该能够单击a卡、B卡、C卡或D卡。每一张卡片都应该带用户进入另一个问题,在这个问题上,用户同样可以点击新的选项——一个基本的对话框树 问题是,无论我如何构造卡片的JSON,当我点

我正在尝试使用Microsoft bot框架创建Azure托管的bot。我在机器人模拟器中一切正常,但当我将机器人部署到团队并尝试与之通信时,我遇到了麻烦。我可以向机器人发送消息,并让它回复我,但这是我所能做到的。 本质上,我只想让用户看到一个问题和四个选项,让他们能够点击一个选项。例如,如果用户看到“进行选择”,他们应该能够单击a卡、B卡、C卡或D卡。每一张卡片都应该带用户进入另一个问题,在这个问题上,用户同样可以点击新的选项——一个基本的对话框树

问题是,无论我如何构造卡片的JSON,当我点击一个选项时,我都无法让它们实际执行任何操作。我的初始对话框代码如下所示:

using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Mime;
using System.Threading;
using System.Threading.Tasks;
using AdaptiveCards;
using Microsoft.Bot.Builder;
using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Builder.Dialogs.Choices;
using Microsoft.Bot.Schema;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace evos.ChatBot
{
    public class InitialDialog : ComponentDialog
    {

        public InitialDialog()
            : base(nameof(InitialDialog))
        {
            AddDialog(new ChoicePrompt(nameof(ChoicePrompt)));

            AddDialog(new ADialog());
            AddDialog(new BDialog());
            AddDialog(new CDialog());
            AddDialog(new DDialog());

            AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[]
            {
                InitialCardChoiceStepAsync,
                StartSelectionStepAsync,
            }));

            InitialDialogId = nameof(WaterfallDialog);
        }

        private async Task<DialogTurnResult> InitialCardChoiceStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var filePath = Path.Combine(".", "Cards", "InitialCard.json");
            var adaptiveCardJson = File.ReadAllText(filePath);

            return await stepContext.PromptAsync(
                nameof(ChoicePrompt),
                new PromptOptions()
                {
                    Prompt = (Activity)MessageFactory.Attachment(new Attachment
                    {
                        ContentType = AdaptiveCard.ContentType,
                        Content = JsonConvert.DeserializeObject(adaptiveCardJson),
                    }),
                },
                cancellationToken);
        }

        private async Task<DialogTurnResult> StartSelectionStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            switch (((FoundChoice)stepContext.Result).Value)
            {
                case "A":
                    return await stepContext.BeginDialogAsync(nameof(ADialog), null, cancellationToken);
                case "B":
                    return await stepContext.BeginDialogAsync(nameof(BDialog), null, cancellationToken);
                case "C":
                    return await stepContext.BeginDialogAsync(nameof(CDialog), null, cancellationToken);
                case "D":
                    return await stepContext.BeginDialogAsync(nameof(DDialog), null, cancellationToken);
                default:
                    return await stepContext.EndDialogAsync(null, cancellationToken);
            }
        }
    }
}
{
  "type": "AdaptiveCard",
  "body": [
    {
      "type": "TextBlock",
      "size": "smaller",
      "weight": "bolder",
      "text": "Please make a selection:"
    },
    {
      "type": "ActionSet",
      "actions": [
        {
          "type": "Action.Submit",
          "title": "A",
          "data": {
            "msteams": {
              "type": "messageBack",
              "displayText": "A!",
              "text": "A"
            }
          }
        },
        {
          "type": "Action.Submit",
          "title": "B",
          "data": {
            "msteams": {
              "type": "messageBack",
              "displayText": "B!",
              "text": "B"
            }
          }
        },
        {
          "type": "Action.Submit",
          "title": "C",
          "data": {
            "msteams": {
              "type": "messageBack",
              "displayText": "C!",
              "text": "C"
            }
          }
        },
        {
          "type": "Action.Submit",
          "title": "D",
          "data": {
            "msteams": {
              "type": "messageBack",
              "displayText": "D!",
              "text": "D"
            }
          }
        }
      ]
    }
  ],
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "version": "1.2"
}
这段代码在模拟器中不再工作了,但是我被卡住了。我觉得我错过了一件非常明显的事情——有人能解释一下我做错了什么吗?

看一看,因为这可能会解释一下如何处理这个问题。否则,试一试。“本机自适应卡事件在提示对话框中不起作用…覆盖提示类并处理AdatpiveCard(JSON格式)事件。”祝您好运!