File tree Expand file tree Collapse file tree 5 files changed +17
-7
lines changed
Expand file tree Collapse file tree 5 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ Node-RED Watson Nodes for IBM Bluemix
99
1010### New in version 0.4.34
1111- Added Keyword and Entity emotion and sentiment as options on Alchemy Feature Extract Node.
12+ - Allow Conversation credentials to be provided on msg.params
13+ - Similarity Search and Visual Recognition Nodes updated to use url based services to detect bound service.
1214
1315### New in version 0.4.33
1416- Personality Insights node updated to latest December 15, 2016 GloVe profiles.
Original file line number Diff line number Diff line change 6868 < li > < code > msg.params.entities</ code > ( optional ) : see API documentation < / l i >
6969 < li > < code > msg.params.output</ code > ( optional ) : see API documentation < / l i >
7070 < li > < code > msg.additional_context</ code > ( optional ) : additional properties that will be added to the context object . Format : Object < / l i >
71+ < br />
72+ < li > < code > msg.params.username</ code > : If provided will be used as the username credential for the Conversation service . < / l i >
73+ < li > < code > msg.params.password</ code > : If provided will be used as the password credential for the Conversation service.</ li >
7174 < / u l >
7275 < p > See < a href = "http://www.ibm.com/watson/developercloud/conversation/api/v1/#send_input" target = "_blank" > Conversation API documentation</ a > for details.</ p >
7376 < p > All Results will made available at < code > msg . payload < / c o d e > i n J S O N f o r m a t . C h e c k t h e < a h r e f = " h t t p : / / www . ibm . com / watson / developercloud / conversation / api / v1 / #send_input" target=" _blank ">documentation</a> for details.</p>
Original file line number Diff line number Diff line change @@ -121,17 +121,20 @@ module.exports = function (RED) {
121121 function verifyServiceCredentials ( node , msg ) {
122122 // If it is present the newly provided user entered key
123123 // takes precedence over the existing one.
124+ // If msg.params contain credentials then these will Overridde
125+ // the bound or configured credentials.
124126 var userName = sUsername || node . credentials . username ,
125127 passWord = sPassword || node . credentials . password ;
126128
127- if ( ! userName || ! passWord ) {
129+ if ( ! ( userName || msg . params . username ) ||
130+ ! ( passWord || msg . params . password ) ) {
128131 node . status ( { fill :'red' , shape :'ring' , text :'missing credentials' } ) ;
129132 node . error ( 'Missing Watson Conversation API service credentials' , msg ) ;
130133 return false ;
131134 }
132135 node . service = new ConversationV1 ( {
133- username : userName ,
134- password : passWord ,
136+ username : msg . params . username ? msg . params . username : userName ,
137+ password : msg . params . password ? msg . params . password : passWord ,
135138 version_date : '2016-09-20'
136139 } ) ;
137140 return true ;
Original file line number Diff line number Diff line change 1515 **/
1616
1717module . exports = function ( RED ) {
18- var cfenv = require ( 'cfenv' ) ,
18+ const SERVICE_IDENTIFIER = 'visual-recognition' ;
19+ var serviceutils = require ( '../../utilities/service-utils' ) ,
1920 watson = require ( 'watson-developer-cloud' ) ,
2021 imageType = require ( 'image-type' ) ,
2122 temp = require ( 'temp' ) ,
@@ -27,7 +28,7 @@ module.exports = function (RED) {
2728 // temp is being used for file streaming to allow the file to arrive so it can be processed.
2829 temp . track ( ) ;
2930
30- service = cfenv . getAppEnv ( ) . getServiceCreds ( / v i s u a l r e c o g n i t i o n / i ) ;
31+ service = serviceutils . getServiceCreds ( SERVICE_IDENTIFIER ) ;
3132
3233 if ( service ) {
3334 sAPIKey = service . api_key ;
Original file line number Diff line number Diff line change 1515 **/
1616
1717module . exports = function ( RED ) {
18- var cfenv = require ( 'cfenv' ) ,
18+ const SERVICE_IDENTIFIER = 'visual-recognition' ;
19+ var serviceutils = require ( '../../utilities/service-utils' ) ,
1920 watson = require ( 'watson-developer-cloud' ) ,
2021 imageType = require ( 'image-type' ) ,
2122 url = require ( 'url' ) ,
@@ -28,7 +29,7 @@ module.exports = function (RED) {
2829 // temp is being used for file streaming to allow the file to arrive so it can be processed.
2930 temp . track ( ) ;
3031
31- service = cfenv . getAppEnv ( ) . getServiceCreds ( / v i s u a l r e c o g n i t i o n / i ) ;
32+ service = serviceutils . getServiceCreds ( SERVICE_IDENTIFIER ) ;
3233
3334 if ( service ) {
3435 sAPIKey = service . api_key ;
You can’t perform that action at this time.
0 commit comments