Bot Framework Compose:动态多选动作(来自API)

Bot Framework Compose: Dynamic multiple choice action (from API)

我正在使用机器人框架编写器 (V2) 构建一个机器人

我想创建一个多项选择操作,其中的选择来自 API 调用。

Api 选项

[
    {
        "id": 0,
        "name": "One",
        "active": true
    },
    {
        "id": 1,
        "name": "Two",
        "active": true
    },
    {
        "id": 2,
        "name": "Three",
        "active": true
    },
    {
        "id": 3,
        "name": "Four",
        "active": true
    },
    {
        "id": 4,
        "name": "Five",
        "active": true
    }
]

如何在多项选择操作中绑定此选项?

我假设您可以调用 API 并获得数组格式的数据,假设它存储在 dialog.response.

所以你需要做的是,

  1. 添加一个For each item: Loop and configure it as shown in screenshot.
  2. 接下来,在循环中添加Edit an Array Property ,并按照截图所示进行配置
  3. 现在,最后,您需要添加 Multi-Choice(您已经添加的)并在 Array of choices 中给出 dialog.choices

我已经测试了这个流程,直到机器人发送了多选卡片。