amazon-connect / amazon-connect-salesforce-lambda

Apache License 2.0
45 stars 34 forks source link

Use selectedAlternative for 0.0 confidence transcriptions #49

Open CGarces opened 1 year ago

CGarces commented 1 year ago

If lastItem['content'] is empty the lastChar calculation will fail.

Issue #, if available:

Description of changes:

If selectedAlternative is empty due a confidence of 0.0, it set the transcript['content'] value as empty.

When that empty value is the last one on transcripts array, the code that calculate the last character some lines bellow, will fail with and string index out of range error.

image

Use selectedAlternative as workarround.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.