如何在 Watson Assistant 的整个多重回复节点中创建上下文变量?

How to create a context variable in the entire multiplied-replies node in Watson Assistant?

要在具有单个回复的节点中添加上下文变量,我只需在该回复中添加一次 var,这就足够了。

但在多个回复节点中,我必须配置每个回复并使用上下文或 JSON 编辑器在每个回复中添加上下文变量。

我可以只添加一次吗?

如果不是,那背后的想法是什么?

为什么除了特定于回复的选项之外,连节点通用变量选项都不存在?

多重响应节点是一种轻松地将不同响应嵌套在一起的方法。在此功能之前,您必须为每个要执行的响应创建一个节点。

这似乎是它的副作用,但很容易解决。

创建主节点并设置上下文变量。然后创建一个子节点并拥有父节点"Skip User Input"。子节点应该有您的多个响应。

示例工作区:

{
  "name": "Example single context for multiresponse node",
  "intents": [],
  "entities": [],
  "language": "en",
  "metadata": {
    "api_version": {
      "major_version": "v1",
      "minor_version": "2017-05-26"
    }
  },
  "description": "",
  "dialog_nodes": [
    {
      "type": "response_condition",
      "title": null,
      "output": {
        "generic": [
          {
            "values": [
              {
                "text": "two $example"
              }
            ],
            "response_type": "text"
          }
        ]
      },
      "parent": "node_1_1532968597524",
      "context": null,
      "metadata": {},
      "next_step": null,
      "conditions": "input.text == \"2\"",
      "description": null,
      "dialog_node": "node_3_1532968635994",
      "previous_sibling": "node_2_1532968631610"
    },
    {
      "type": "response_condition",
      "title": null,
      "output": {
        "generic": [
          {
            "values": [
              {
                "text": "one $example"
              }
            ],
            "response_type": "text",
            "selection_policy": "sequential"
          }
        ]
      },
      "parent": "node_1_1532968597524",
      "context": null,
      "metadata": {},
      "next_step": null,
      "conditions": "input.text == \"1\"",
      "description": null,
      "dialog_node": "node_2_1532968631610",
      "previous_sibling": null
    },
    {
      "type": "standard",
      "title": "Enter 1 or 2 to trigger.",
      "output": {},
      "parent": "node_4_1532968810899",
      "context": null,
      "metadata": {
        "_customization": {
          "mcr": true
        }
      },
      "next_step": null,
      "conditions": "anything_else",
      "description": null,
      "dialog_node": "node_1_1532968597524",
      "digress_out": "allow_all",
      "previous_sibling": null
    },
    {
      "type": "standard",
      "title": "$example set to value of \"example\"",
      "output": {
        "generic": [
          {
            "values": [],
            "response_type": "text",
            "selection_policy": "sequential"
          }
        ]
      },
      "parent": null,
      "context": {
        "example": "example"
      },
      "metadata": {},
      "next_step": {
        "behavior": "skip_user_input"
      },
      "conditions": "anything_else",
      "description": null,
      "dialog_node": "node_4_1532968810899",
      "previous_sibling": "Welcome"
    },
    {
      "type": "standard",
      "title": "Anything else",
      "output": {
        "generic": [
          {
            "values": [
              {
                "text": "I didn't understand. You can try rephrasing."
              },
              {
                "text": "Can you reword your statement? I'm not understanding."
              },
              {
                "text": "I didn't get your meaning."
              }
            ],
            "response_type": "text",
            "selection_policy": "sequential"
          }
        ]
      },
      "parent": null,
      "context": null,
      "metadata": {},
      "next_step": null,
      "conditions": "anything_else",
      "description": null,
      "dialog_node": "Anything else",
      "previous_sibling": "node_4_1532968810899"
    },
    {
      "type": "standard",
      "title": "Welcome",
      "output": {
        "generic": [
          {
            "values": [
              {
                "text": "Hello. How can I help you?"
              }
            ],
            "response_type": "text",
            "selection_policy": "sequential"
          }
        ]
      },
      "parent": null,
      "context": null,
      "metadata": {},
      "next_step": null,
      "conditions": "welcome",
      "description": null,
      "dialog_node": "Welcome",
      "previous_sibling": null
    }
  ],
  "workspace_id": "9e5b9851-5f0e-4e5f-9523-d2ac7045bf1d",
  "counterexamples": [],
  "system_settings": {
    "tooling": {
      "store_generic_responses": true
    },
    "disambiguation": {
      "prompt": "Did you mean:",
      "none_of_the_above_prompt": "None of the above"
    },
    "human_agent_assist": {
      "prompt": "Did you mean:"
    }
  },
  "learning_opt_out": false
}