emit AWSProvider response
This commit is contained in:
parent
88267ddca0
commit
e9a3d38d58
1 changed files with 13 additions and 6 deletions
|
@ -500,13 +500,20 @@ class AWSProvider extends Writable {
|
||||||
for await (const event of res.TranscriptResultStream) {
|
for await (const event of res.TranscriptResultStream) {
|
||||||
if (event.TranscriptEvent) {
|
if (event.TranscriptEvent) {
|
||||||
const results = event.TranscriptEvent.Transcript.Results;
|
const results = event.TranscriptEvent.Transcript.Results;
|
||||||
|
if(results[0] !== undefined) {
|
||||||
|
if(!results[0].IsPartial) {
|
||||||
|
console.debug("AWSProvider: result: " + results[0].Alternatives[0].Transcript);
|
||||||
|
const result = {
|
||||||
|
"text": results[0].Alternatives[0].Transcript
|
||||||
|
};
|
||||||
|
|
||||||
|
this.emit('result', result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Print all the possible transcripts
|
// Print all the possible transcripts
|
||||||
results.map((result) => {
|
//
|
||||||
(result.Alternatives || []).map((alternative) => {
|
// });
|
||||||
const transcript = alternative.Items.map((item) => item.Content).join(" ");
|
|
||||||
console.log(transcript);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
|
|
Loading…
Reference in a new issue