How to remove a context variable in Watson Convers

2019-03-01 06:49发布

I am using this, but this only sets it to empty,

{
  "context": {
    "time": "",
    "place": "",
    "things": "",
    "transport": ""
  },
  "output": {}
}

I also tried "time": "null" and "time": "$time.remove"

3条回答
戒情不戒烟
2楼-- · 2019-03-01 06:59

The best is to use context.remove() in the output section. I usually have an extra child node for cleanup.

{
  "output": {
    "text": {},
    "deleted": "<? context.remove('eventName') ?> <? context.remove('queryPredicate') ?>"
  }
}

Because deleted is not part of the context section it won't be carried forward.

查看更多
太酷不给撩
3楼-- · 2019-03-01 07:05

I believe the following does what you want.

{
  "output": {
    "text": {
      "values": [
        "Ok got it: $Var1, $Var2, $Var3. <? $Var1 = NULL ?> <? $Var2 = NULL ?> <? $Var3 = NULL ?>"
      ],
      "selection_policy": "sequential"
    }
  }
}
查看更多
啃猪蹄的小仙女
4楼-- · 2019-03-01 07:06

You can also add a child node and add jump to the child node after response with the condition set to true and set the context variable to null there.

查看更多
登录 后发表回答