emit AWSProvider response

This commit is contained in:
Dovi Cowan 2023-07-05 19:02:18 +01:00
parent 88267ddca0
commit e9a3d38d58
Signed by: dcowan
GPG key ID: 697AE484978D5F89

View file

@ -500,13 +500,20 @@ class AWSProvider extends Writable {
for await (const event of res.TranscriptResultStream) {
if (event.TranscriptEvent) {
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
results.map((result) => {
(result.Alternatives || []).map((alternative) => {
const transcript = alternative.Items.map((item) => item.Content).join(" ");
console.log(transcript);
});
});
//
// });
}
};
}).catch((err) => {