ibm-cloud - IBM Watson Assistant / Conversation:输出显示最后一次搜索
问题描述
我已经开发了云功能,并且正在使用带有图像响应类型以及文本的“通用输出”。但是,当我搜索产品(使用我的云功能)时,会出现最后一个结果。
例如:
我:现在买经典
机器人:名称:经典,价格:4.99,描述:经典描述
但是当我搜索另一种产品时
我:现在买额外的
机器人将显示
机器人:名称:经典,价格:4.99,描述:经典描述
只有在另一个搜索实例之前,它才会刷新并显示正确的结果。
{
"context": {
"name": "",
"counter": 0
},
"output": {
"generic": [
{
"values": [
{
"text": "Found Products"
}
],
"response_type": "text",
"selection_policy": "sequential"
},
{
"title": "<? $result.body.items[0].name ?>",
"source": "http://**********/pub/media/catalog/product<? $result.body.items[0].custom_attributes[5].value ?>",
"description": "$<? $result.body.items[0].price ?>",
"response_type": "image"
},
{
"title": "Select one of the following options",
"options": [
{
"label": "Order a subscription",
"value": {
"input": {
"text": "Order a subscription"
}
}
},
{
"label": "More Details",
"value": {
"input": {
"text": "More Details"
}
}
}
],
"response_type": "option"
}
]
},
"actions": [
{
"name": "/**********@gmail.com_dev/getProducts2",
"type": "server",
"parameters": {
"url": "<?entities.products[0].literal?>"
},
"credentials": "$my_creds",
"result_variable": "context.result"
}
]
}
解决方案
找到了答案。我将输出文本放在子节点而不是父节点中。无需删除任何上下文变量。
推荐阅读
- swift - 终端无法识别 pod 文件
- javascript - 使用纯Javascript查找数组中满足条件的前几个元素
- docker - docker 在 TeamCity 命令行构建步骤中使用默认命令运行
- java - Java Head First 练习
- python - 如何抓取 HTML 表格格式的数据?
- r - R中有没有办法在每个行列索引处比较多维数组的层以确定最大值
- python - Raspberry Debian 在启动时运行失败,但 manuel 运行完美
- conditional-statements - 使用 R 根据条件格式更新 .csv 文件
- laravel - Laravel-echo-server、Redis 和 Ubuntu 18.04.4 [ioredis] 错误:连接 ETIMEDOUT
- python - KivyMD:独立的登录屏幕和 MDBottomNavigation