File tree Expand file tree Collapse file tree 4 files changed +15
-8
lines changed
Expand file tree Collapse file tree 4 files changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ Node-RED Watson Nodes for IBM Cloud
77
88<a href =" https://cla-assistant.io/watson-developer-cloud/node-red-node-watson " ><img src =" https://cla-assistant.io/readme/badge/watson-developer-cloud/node-red-node-watson " alt =" CLA assistant " /></a >
99
10+ ### New in version 0.6.10
11+ - Needed to stringify json before addDocument in Discovery node.
12+ - Using Node.js v 6 features, so will not run on Node.js v 4 anymore
13+
1014### New in version 0.6.9
1115- Implemented classify collection on Natural Language Classifier node. The collection can be
1216in the form of multiple sentences, an array of strings, or an array of objects.
Original file line number Diff line number Diff line change 11{
22 "name" : " node-red-node-watson" ,
3- "version" : " 0.6.9 " ,
3+ "version" : " 0.6.10 " ,
44 "description" : " A collection of Node-RED nodes for IBM Watson services" ,
55 "dependencies" : {
66 "async" : " ^1.5.2" ,
5555 }
5656 },
5757 "engines" : {
58- "node" : " >=4.5 .0"
58+ "node" : " >=6.12 .0"
5959 }
6060}
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ DiscoveryUtils.prototype = {
5858 params . file = this . isJsonObject ( msg . payload ) ?
5959 JSON . stringify ( msg . payload ) :
6060 msg . payload ;
61+ params . file_content_type = 'application/json' ;
6162 }
6263 return params ;
6364 } ,
@@ -313,7 +314,8 @@ DiscoveryUtils.prototype = {
313314 } ,
314315
315316 isJsonObject : function ( str ) {
316- if ( str instanceof Array || str instanceof Object ) {
317+ if ( str instanceof Array || str instanceof Object ||
318+ 'object' === typeof str || Array . isArray ( str ) ) {
317319 return true ;
318320 }
319321 return false ;
Original file line number Diff line number Diff line change @@ -141,12 +141,13 @@ module.exports = function (RED) {
141141 }
142142
143143 discovery = new DiscoveryV1 ( serviceSettings ) ;
144- // addJsonDocument is deprecated
145- //if ('.json' === suffix) {
146- // method = 'addJsonDocument';
144+ // modify as getting addJsonDocument will be deprecated messages
145+ if ( '.json' === suffix ) {
146+ //method = 'addJsonDocument';
147+ params . file = JSON . stringify ( params . file ) ;
147148 //} else {
148- // method = 'addDocument';
149- // }
149+ // method = 'addDocument';
150+ }
150151 method = 'addDocument' ;
151152
152153 discovery [ method ] ( params , function ( err , response ) {
You can’t perform that action at this time.
0 commit comments