要在一个响应中的节点中添加上下文变量,我只需在响应中添加一次var,就足够了。
但是在多个回复节点中,我必须配置每个响应,并使用上下文或JSON编辑器在每个响应中添加上下文变量。
我只能添加一次吗?
如果不是,那是什么主意?
为什么除了回复专用变量之外,甚至没有节点通用变量选项?
答案 0 :(得分:1)
多重响应节点是一种轻松地将不同响应嵌套在一起的方法。在使用此功能之前,您必须为要执行的每个响应创建一个节点。
这似乎是其副作用,但很容易解决。
创建您的主节点并设置上下文变量。然后创建一个子节点,并具有父节点“跳过用户输入”。子节点应该有多个响应。
示例工作区:
{
"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
}