Javascript Watson Conversation node.js使用learning_opt_out创建工作区

Javascript Watson Conversation node.js使用learning_opt_out创建工作区,javascript,node.js,ibm-watson,watson-assistant,Javascript,Node.js,Ibm Watson,Watson Assistant,我正在尝试在node.js中创建一个新的watson对话工作区,其中包含learning\u opt\u out true。 下面的代码创建了工作区,但是learning\u opt\u out仍然是false 你能帮忙吗 var watson = require("watson-developer-cloud"); var conversation = new watson.ConversationV1({ username: 'user', password: 'password'

我正在尝试在node.js中创建一个新的watson对话工作区,其中包含
learning\u opt\u out true
。 下面的代码创建了工作区,但是
learning\u opt\u out
仍然是
false

你能帮忙吗

var watson = require("watson-developer-cloud");

var conversation = new watson.ConversationV1({
  username: 'user',
  password: 'password',
  url: 'https://gateway-fra.watsonplatform.net/conversation/api/',
  version_date: '2017-05-26'
});

var workspace = {
  name: 'API test',
  description: 'Example workspace created via API.',
  language: 'de',
  learning_opt_out: 'true'
};

conversation.createWorkspace(workspace, function(err, response) {
  if (err) {
    console.error(err);
  } else {
    console.log(JSON.stringify(response, null, 2));
  }
 });
运行此代码将创建以下输出:

{
  "name": "API test",
  "created": "2017-10-27T12:16:11.170Z",
  "updated": "2017-10-27T12:16:11.170Z",
  "language": "de",
  "metadata": null,
  "description": "Example workspace created via API.",
  "workspace_id": "xxx",
  "learning_opt_out": false
}
如图所示,
学习选择退出
的参数为布尔值

learning_opt_out(布尔值,可选):是否从 IBM可以使用workspace进行一般服务改进。真的 指示不使用工作区培训数据

编辑:

在了解了有关此问题和参数learning_opt__out的更多信息后,我想知道答案,您需要在通话服务中设置一个
标题
,以及您的
用户名
密码

例如:

var watson = require("watson-developer-cloud");

var conversation = new watson.ConversationV1({
  username: 'user',
  password: 'pass',
  url: 'https://gateway-fra.watsonplatform.net/conversation/api/',
  version_date: '2017-05-26',
  //X-WDC-PL-OPT-OUT: true
  headers: {
       'X-Watson-Learning-Opt-Out': true
  }
});

var workspace = {
  name: 'API test',
  description: 'Example workspace created via API.',
  language: 'de',
  //'X-WDC-PL-OPT-OUT': true
};

conversation.createWorkspace(workspace, function(err, response) {
  if (err) {
    console.error(err);
  } else {
    console.log(JSON.stringify(response, null, 2));
  }
});
结果是:

{
  "name": "API test",
  "created": "2017-11-03T12:16:08.025Z",
  "updated": "2017-11-03T12:16:08.025Z",
  "language": "de",
  "metadata": null,
  "description": "Example workspace created via API.",
  "workspace_id": "c143cfd2-2350-491e-bc58-b9debf06e03f",
  "learning_opt_out": true
}
  • 请参阅有关对象的详细信息
  • 沃森API资源管理器示例
您好-我现在将其改为“学习选择退出:正确”。。响应仍然是:{“名称”:“API测试”,“创建”:“2017-11-03T11:17:47.730Z”,“更新”:“2017-11-03T11:17:47.730Z”,“语言”:“de”,“元数据”:null,“描述”:“通过API创建的示例工作区”,“工作区id”:“xxxxxx”,“学习选择退出”:false}因此,我解决了问题,请尝试查看我的编辑