如何在消息扩展中使用多个参数?

How do I use multiple parameters in a messaging extension?

我正在尝试创建一个在 Teams 中使用两个参数的消息传递扩展。

我创建了一个消息传递扩展,它在清单中有两个参数。在此之后,我在节点中使用 botbuilder-teams v4.0.0-beta1 包制作了一个机器人服务器。

清单包含以下内容:

    "composeExtensions": [
        {
            "botId": "########-####-####-####-############",
            "canUpdateConfiguration": true,
            "commands": [
                {
                    "id": "Test",
                    "title": "Test",
                    "description": "test",
                    "initialRun": true,
                    "parameters": [
                        {
                            "name": "Param1",
                            "title": "Param 1",
                            "description": "This is param 1"
                        },
                        {
                            "name": "Param2",
                            "title": "param 2",
                            "description": "param 2"
                        }
                    ]
                }
            ]
        }
    ],

我的服务器中有以下代码来回复消息扩展请求

private onMessagingExtensionQuery = async (ctx: TurnContext, query: teams.MessagingExtensionQuery): Promise<teams.InvokeResponseTyped<teams.MessagingExtensionResponse>> => {
    console.log(query);
    type R = teams.InvokeResponseTypeOf<'onMessagingExtensionQuery'>;
    let heroCard1 = CardFactory.heroCard('Result Card1', '<pre>This card mocks the CE results 1</pre>');
    let heroCard2 = CardFactory.heroCard('Result Card2', '<pre>This card mocks the CE results 2</pre>');
    let response: R = {
      status: 200,
      body: {
        composeExtension: {
          type: 'result',
          attachmentLayout: 'list',
          attachments: [
            {...heroCard1},
            {...heroCard2}
          ]
        }
      }
    };
    return Promise.resolve(response);
  };

当我尝试使用我的消息传递扩展程序时,我输入第一个参数并显示两个结果卡,我可以 select 一个。但是,在此之后我无法输入第二个参数。相反,我只是在我的聊天框中准备好 selected 卡片发送给我的机器人。

如何使用这两个消息扩展参数?

谢谢

Multi-parameter 仅支持设置为操作的命令类型。对于查询,我们目前仅支持 1 个参数。它在 UI 中的显示方式是在任务模块中使用简单的形式。