File tree Expand file tree Collapse file tree 4 files changed +24
-4
lines changed
services/visual_recognition Expand file tree Collapse file tree 4 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ 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.2
11+ - Visual Recognition fix for accept-language
12+
1013### New in version 0.6.1
1114- Allow STT Language to be dyamically configurable using msg.srclang
1215
Original file line number Diff line number Diff line change 11{
22 "name" : " node-red-node-watson" ,
3- "version" : " 0.6.1 " ,
3+ "version" : " 0.6.2 " ,
44 "description" : " A collection of Node-RED nodes for IBM Watson services" ,
55 "dependencies" : {
66 "async" : " ^1.5.2" ,
Original file line number Diff line number Diff line change 3636 < input type = "text" id = "node-input-name" placeholder = "Name" >
3737 </ div >
3838 < div class = "form-row" id = "lang-group" >
39- < label for = "node-input-lang-label " > < i class = "fa fa-language" > </ i > Language</ label >
39+ < label for = "node-input-lang" > < i class = "fa fa-language" > </ i > Language</ label >
4040 < select type = "text" id = "node-input-lang" style = "display: inline-block; width: 70%;" >
4141 < option selected = "selected" value = "en" > English</ option >
4242 < option value = "es" > Spanish</ option >
43+ < option value = "de" > German</ option >
44+ < option value = "it" > Italian</ option >
4345 < option value = "ar" > Arabic</ option >
4446 < option value = "ja" > Japanese</ option >
47+ < option value = "ko" > Korean</ option >
4548 </ select >
4649 </ div >
4750</ script >
4851
52+
4953< script type ="text/x-red " data-template-name ="visual-recognition-util-v3 ">
5054 < div id = "credentials-check" class = "form-row" >
5155 < div class = "form-tips" >
Original file line number Diff line number Diff line change @@ -142,13 +142,26 @@ module.exports = function(RED) {
142142 return Promise . reject ( 'Missing Watson Visual Recognition API service credentials' ) ;
143143 }
144144
145- node . service = new VisualRecognitionV3 ( {
145+ var serviceSettings = {
146146 api_key : node . apikey ,
147147 version_date : VisualRecognitionV3 . VERSION_DATE_2016_05_20 ,
148148 headers : {
149149 'User-Agent' : pkg . name + '-' + pkg . version
150150 }
151- } ) ;
151+ } ;
152+
153+ // The change to watson-developer-cloud 3.0.x has resulted in a
154+ // change in how the Accept-Language is specified. It now needs
155+ // to go in as a header.
156+
157+ if ( node . config != null && node . config . lang != null ) {
158+ serviceSettings . headers [ 'Accept-Language' ] = node . config . lang ;
159+ }
160+ if ( msg . params != null && msg . params . accept_language != null ) {
161+ serviceSettings . headers [ 'Accept-Language' ] = msg . params [ 'accept_language' ] ;
162+ }
163+
164+ node . service = new VisualRecognitionV3 ( serviceSettings ) ;
152165
153166 return Promise . resolve ( ) ;
154167 }
You can’t perform that action at this time.
0 commit comments