File tree 3 files changed +13
-2
lines changed
services/language_translator
3 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ Node-RED Watson Nodes for IBM Bluemix
7
7
8
8
<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 >
9
9
10
+ ### New in version 0.4.23
11
+ - Fix to Language Translator Train Node to allow it work with File Inject
12
+
10
13
### New in version 0.4.22
11
14
- Added new Date Extraction Node
12
15
- Visual Recognition Node, now defaults detection setting and language on initial initialisation.
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " node-red-node-watson" ,
3
- "version" : " 0.4.22 " ,
3
+ "version" : " 0.4.23 " ,
4
4
"description" : " A collection of Node-RED nodes for IBM Watson services" ,
5
5
"dependencies" : {
6
6
"alchemy-api" : " ^1.3.0" ,
Original file line number Diff line number Diff line change @@ -176,6 +176,9 @@ module.exports = function (RED) {
176
176
177
177
// If training is requested then the glossary will be a file input. We are using temp
178
178
// to sync up the fetch of the file input stream, before invoking the train service.
179
+ // If the file comes from a file-inject then the file will not have a filename assoicated
180
+ // with it. In this case a temporary filename is given to the file. The file name submitted
181
+ // to the service cannot have a '.' else it will throw a 400 error.
179
182
var doTrain = function ( msg , model_id , filetype ) {
180
183
node . status ( {
181
184
fill : 'blue' ,
@@ -189,8 +192,13 @@ module.exports = function (RED) {
189
192
if ( ! err ) {
190
193
fs . write ( info . fd , msg . payload ) ;
191
194
var params = { } ;
195
+
192
196
// only letters and numbers allowed in the submitted file name
193
- params . name = msg . filename . replace ( / [ ^ 0 - 9 a - z ] / gi, '' ) ;
197
+ // Default the name to a string representing now
198
+ params . name = ( new Date ( ) ) . toString ( ) . replace ( / [ ^ 0 - 9 a - z ] / gi, '' ) ;
199
+ if ( msg . filename ) {
200
+ params . name = msg . filename . replace ( / [ ^ 0 - 9 a - z ] / gi, '' ) ;
201
+ }
194
202
params . base_model_id = model_id ;
195
203
switch ( filetype ) {
196
204
case 'forcedglossary' :
You can’t perform that action at this time.
0 commit comments