File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717module . exports = function ( RED ) {
1818 const SERVICE_IDENTIFIER = 'speech-to-text' ;
1919 var temp = require ( 'temp' ) ,
20+ request = require ( 'request' ) ,
2021 url = require ( 'url' ) ,
2122 fs = require ( 'fs' ) ,
2223 WebSocket = require ( 'ws' ) ,
@@ -298,6 +299,7 @@ module.exports = function (RED) {
298299 return tokenService ;
299300 }
300301
302+
301303 function performSTT ( speech_to_text , audioData ) {
302304 var p = new Promise ( function resolver ( resolve , reject ) {
303305 var model = config . lang + '_' + config . band ,
@@ -330,6 +332,7 @@ module.exports = function (RED) {
330332 resolve ( res ) ;
331333 }
332334 } ) ;
335+
333336 } ) ;
334337 return p ;
335338 }
@@ -637,6 +640,9 @@ module.exports = function (RED) {
637640 if ( config [ 'streaming-mode' ] ) {
638641 return performStreamSTT ( sttService , audioData ) ;
639642 } else {
643+ if ( apikey ) {
644+ node . warn ( 'STT Speech Recognition may not work with API Key!' ) ;
645+ }
640646 return performSTT ( sttService , audioData ) ;
641647 }
642648 } )
You can’t perform that action at this time.
0 commit comments