IBM Watson Assistant / Conversation:输出显示上次搜索

IBM Watson Assistant / Conversation : The output displays the last search

我开发了云功能,并且正在使用 'generic output' 图像响应类型,以及文本。但是,当我搜索产品(使用我的云功能)时,会出现最后的结果。

例如:

Me: Buy Classic now

Bot: Name: Classic, Price: 4.99, Description: Classic description

但是当我搜索其他产品时

Me: Buy Extra now

机器人将显示

Bot: Name: Classic, Price: 4.99, Description: Classic description

直到另一个搜索实例才会刷新并显示正确的结果。

{
  "context": {
    "name": "",
    "counter": 0
  },
  "output": {
    "generic": [
      {
        "values": [
          {
            "text": "Found  Products"
          }
        ],
        "response_type": "text",
        "selection_policy": "sequential"
      },
      {
        "title": "<? $result.body.items[0].name ?>",
        "source": "http://**********/pub/media/catalog/product<? $result.body.items[0].custom_attributes[5].value ?>",
        "description": "$<? $result.body.items[0].price ?>",
        "response_type": "image"
      },
      {
        "title": "Select one of the following options",
        "options": [
          {
            "label": "Order a subscription",
            "value": {
              "input": {
                "text": "Order a subscription"
              }
            }
          },
          {
            "label": "More Details",
            "value": {
              "input": {
                "text": "More Details"
              }
            }
          }
        ],
        "response_type": "option"
      }
    ]
  },
  "actions": [
    {
      "name": "/**********@gmail.com_dev/getProducts2",
      "type": "server",
      "parameters": {
        "url": "<?entities.products[0].literal?>"
      },
      "credentials": "$my_creds",
      "result_variable": "context.result"
    }
  ]
}

找到答案了。我将输出文本放在子节点而不是父节点中。无需删除任何上下文变量。