Api Watson : Conversation, internal error

依然范特西╮ 提交于 2019-12-25 06:35:05

问题


I am trying to use the updateWorkspace function of the Conversation API of Watson but I always get this error :

{"error":"Internal Error"}

My request looks like this :

curl 
-H "Content-Type: application/json" -X POST 
-u "username":"password"
-d "{\"name\":\"Edubot\",\"dialog_nodes\":
[{\"dialog_node\":\"bonjour\",\"conditions\":\"#Bonjour\",\"output\":
{\"text\":{\"values\":[\"bonjour\"],\"selection_policy\":\"sequential\"}}},    
{\"\dialog_node\":\"Aurevoir\",\"conditions\":\"#Aurevoir\",\"output\":
{\"text\":{\"values\":[\"Au revoir\"],\"selection_policy\":\"sequential\"}}}]}" 
"https://gateway.watsonplatform.net/conversation/api/v1/workspaces/workspace_id?version=2016-09-20"

The strange thing is that if I put only one dialog node it works great, but if I add two dialog nodes or more I get the internal error.


回答1:


When you have more than one nodes in your dialog tree, you need to specify "previous_sibling" attribute in your node definition, otherwise the dialog tree remains undefined. For example,

{
    "dialog_nodes": [
        {
            "conditions": "#Bonjour",
            "dialog_node": "bonjour",
            "output": {
                "text": {
                    "selection_policy": "sequential",
                    "values": [
                        "bonjour"
                    ]
                }
            }
        },
        {
            "conditions": "#Aurevoir",
            "dialog_node": "Aurevoir",
            "output": {
                "text": {
                    "selection_policy": "sequential",
                    "values": [
                        "Au revoir"
                    ]
                }
            },
            "previous_sibling": "bonjour"
        }
    ]
}


来源:https://stackoverflow.com/questions/42908862/api-watson-conversation-internal-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!