为什么 IBM Watson Assistant Complex 对象属性不更新?
Why IBM Watson Assistant Complex object properties do not update?
根据文档 "If the context variable is a complex type such as JSON object, a JSON merge procedure is used to update the variable. The merge operation adds any newly defined properties and overwrites any existing properties of the object."。但是当我尝试时它不起作用。
节点中的代码:
"context": {
"comp_obj": "{a:1,b:2}"
}
下一个节点中的代码:
"context": {
"comp_obj": "{a:3}"
}
但是当我使用 Manage Context 检查值时它显示 $comp_obj = "{a:3}"
而不是 "{a:3, b:2}"
,所以我错过了什么吗?
问题是您将值定义为字符串而不是 JSON 对象。
将:"{a:1,b:2}"
更改为:{"a":1, "b":2}
,它应该可以正常工作。
根据文档 "If the context variable is a complex type such as JSON object, a JSON merge procedure is used to update the variable. The merge operation adds any newly defined properties and overwrites any existing properties of the object."。但是当我尝试时它不起作用。
节点中的代码:
"context": {
"comp_obj": "{a:1,b:2}"
}
下一个节点中的代码:
"context": {
"comp_obj": "{a:3}"
}
但是当我使用 Manage Context 检查值时它显示 $comp_obj = "{a:3}"
而不是 "{a:3, b:2}"
,所以我错过了什么吗?
问题是您将值定义为字符串而不是 JSON 对象。
将:"{a:1,b:2}"
更改为:{"a":1, "b":2}
,它应该可以正常工作。