沃森对话中的多输出文本值设置
Multiple output text value setting in watson conversation
我在对话中有以下节点。我想提出行动并根据需要调用 API。在成功场景中,将显示 output.text[0] 和从 output.text[1]
获取的错误场景
{
"output": {
"text": {
"values": [
"I want to get this with success scenario",
"I want to get this with error scenario"
],
"selection_policy": "sequential"
},
"action": "MyAction"
}
}
但是当我在 node.js 中访问这个对话节点时,它总是会给出第一个值,即 'I want to get this with success scenario' 它永远不会给出像 'I want to get this with error scenario' 这样的输出。
如何解决这个问题?
这个问题很难回答,因为取决于您在聊天机器人中的业务角色。
但是,如果您想根据条件回复一条消息...
你可以在你的输出中看到 selection_policy
是 sequential
,换句话说,first 将显示第一个短语,如果条件再次被用户访问,将显示第二条消息。
"The order in which values in the array are returned depends on the attribute selection_policy
."
解决此问题的更好形式是在节点流中为每个短语创建两个条件。
例如第一个条件流程:
if bot recognizes successScenario response "I want to get this with success scenario"
在另一个第二个条件流程中:
if bot recognizes errorScenario response "I want to get this with error scenario"
而您的 Nodejs 应用程序将根据条件获取值。
查看官方文档here,搜索selection_policy
。
我已经通过以下方式解决了这个问题。
{
"output": {
"text": {
"values": [
{
"successMsg": "success Message",
"errorMsg": "error message"
}
]
},
"action": "MyAction"
}
}
不使用新节点的原因,因为通过此操作,我需要创建 API 并基于 API 调用成功和失败向用户显示此消息。然后它将有助于节省一次往返,因为不需要再次将结果状态发送到对话服务,它将根据此节点本身识别向用户呈现什么。
我在对话中有以下节点。我想提出行动并根据需要调用 API。在成功场景中,将显示 output.text[0] 和从 output.text[1]
获取的错误场景{
"output": {
"text": {
"values": [
"I want to get this with success scenario",
"I want to get this with error scenario"
],
"selection_policy": "sequential"
},
"action": "MyAction"
}
}
但是当我在 node.js 中访问这个对话节点时,它总是会给出第一个值,即 'I want to get this with success scenario' 它永远不会给出像 'I want to get this with error scenario' 这样的输出。
如何解决这个问题?
这个问题很难回答,因为取决于您在聊天机器人中的业务角色。
但是,如果您想根据条件回复一条消息...
你可以在你的输出中看到 selection_policy
是 sequential
,换句话说,first 将显示第一个短语,如果条件再次被用户访问,将显示第二条消息。
"The order in which values in the array are returned depends on the attribute selection_policy
."
解决此问题的更好形式是在节点流中为每个短语创建两个条件。
例如第一个条件流程:
if bot recognizes successScenario response "I want to get this with success scenario"
在另一个第二个条件流程中:
if bot recognizes errorScenario response "I want to get this with error scenario"
而您的 Nodejs 应用程序将根据条件获取值。
查看官方文档here,搜索selection_policy
。
我已经通过以下方式解决了这个问题。
{
"output": {
"text": {
"values": [
{
"successMsg": "success Message",
"errorMsg": "error message"
}
]
},
"action": "MyAction"
}
}
不使用新节点的原因,因为通过此操作,我需要创建 API 并基于 API 调用成功和失败向用户显示此消息。然后它将有助于节省一次往返,因为不需要再次将结果状态发送到对话服务,它将根据此节点本身识别向用户呈现什么。