Skip to content

Commit c3d835b

Browse files
committed
fix: stabilize package by reverting to old recognize-stream class that includes iam bug fixes
1 parent c1442b4 commit c3d835b

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

examples/server.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ var sttAuthService = new AuthorizationV1(
8888
Object.assign(
8989
{
9090
username: process.env.SPEECH_TO_TEXT_USERNAME, // or hard-code credentials here
91-
password: process.env.SPEECH_TO_TEXT_PASSWORD,
92-
iam_apikey: process.env.SPEECH_TO_TEXT_IAM_APIKEY // if using an RC service
91+
password: process.env.SPEECH_TO_TEXT_PASSWORD
92+
// iam_apikey: process.env.SPEECH_TO_TEXT_IAM_APIKEY // if using an RC service
9393
},
9494
vcapServices.getCredentials('speech_to_text') // pulls credentials from environment in bluemix, otherwise returns {}
9595
)

speech-to-text/recognize-stream.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,15 @@ var OPENING_MESSAGE_PARAMS_ALLOWED = [
3838
'speaker_labels'
3939
];
4040

41-
var QUERY_PARAMS_ALLOWED = ['customization_id', 'acoustic_customization_id', 'model', 'watson-token', 'access_token', 'X-Watson-Learning-Opt-Out'];
41+
var QUERY_PARAMS_ALLOWED = [
42+
'language_customization_id',
43+
'customization_id',
44+
'acoustic_customization_id',
45+
'model',
46+
'watson-token',
47+
'access_token',
48+
'X-Watson-Learning-Opt-Out'
49+
];
4250

4351
/**
4452
* pipe()-able Node.js Duplex stream - accepts binary audio and emits text/objects in it's `data` events.
@@ -144,8 +152,14 @@ RecognizeStream.prototype.initialize = function() {
144152
options['X-Watson-Learning-Opt-Out'] = options['X-WDC-PL-OPT-OUT'];
145153
}
146154

155+
// compatibility code for the deprecated param, customization_id
156+
if (options.customization_id && !options.language_customization_id) {
157+
options.language_customization_id = options.customization_id;
158+
delete options.customization_id;
159+
}
160+
147161
var queryParams = util._extend(
148-
'customization_id' in options ? pick(options, QUERY_PARAMS_ALLOWED) : { model: 'en-US_BroadbandModel' },
162+
'language_customization_id' in options ? pick(options, QUERY_PARAMS_ALLOWED) : { model: 'en-US_BroadbandModel' },
149163
pick(options, QUERY_PARAMS_ALLOWED)
150164
);
151165

0 commit comments

Comments
 (0)