@onereach/step-voice 6.1.21 → 6.1.22-VOIC1342.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dst/voice.js +16 -13
  2. package/package.json +1 -1
package/dst/voice.js CHANGED
@@ -106,6 +106,7 @@ class VoiceStep extends step_1.default {
106
106
  extractSectionMessages(sections, interruptionMetadata) {
107
107
  return lodash_1.default.chain(sections)
108
108
  .filter(s => Boolean(s.text))
109
+ .slice(0, interruptionMetadata?.sectionIndex)
109
110
  .map((s, index) => {
110
111
  // Should escape html, max length 4000 symbols
111
112
  let text = s.text?.slice(0, 4000).replace(/(<[^>]+>|<\/[^>]+>)/gi, ' ') ?? '';
@@ -128,7 +129,7 @@ class VoiceStep extends step_1.default {
128
129
  const playedTimeSec = playedTime / 1000;
129
130
  const wordsPerSecond = totalWords / sectionDurationSec;
130
131
  const wordsPlayed = Math.floor(wordsPerSecond * playedTimeSec);
131
- return words.slice(0, wordsPlayed).join(' ');
132
+ return words.slice(0, wordsPlayed).join(' ').trim();
132
133
  }
133
134
  extractSectionFiles(sections) {
134
135
  return lodash_1.default.chain(sections)
@@ -217,19 +218,21 @@ class VoiceStep extends step_1.default {
217
218
  * which was returned from the interrupted message,
218
219
  * try to update the reporting message.
219
220
  */
220
- if (interruptionMetadata?.reporterTranscriptEventId) {
221
+ if (interruptionMetadata?.reporterTranscriptEventId &&
222
+ reportingObject.message) {
223
+ const updateReportingObject = {
224
+ EventId: eventId,
225
+ Timestamp: new Date().toISOString(),
226
+ Event: 'Augment',
227
+ EventValue: {
228
+ eventId: interruptionMetadata.reporterTranscriptEventId,
229
+ eventValue: {
230
+ Message: reportingObject.message,
231
+ },
232
+ },
233
+ };
234
+ this.log.debug('updateReportingObject', updateReportingObject);
221
235
  if (this.process.cache.hitl) {
222
- const updateReportingObject = {
223
- EventId: eventId,
224
- Timestamp: new Date().toISOString(),
225
- Event: 'Augment',
226
- EventValue: {
227
- eventId: interruptionMetadata.reporterTranscriptEventId,
228
- eventValue: {
229
- Message: reportingObject.message,
230
- }
231
- }
232
- };
233
236
  await this.process.cache.hitl.queueEvents([updateReportingObject]);
234
237
  }
235
238
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/step-voice",
3
- "version": "6.1.21",
3
+ "version": "6.1.22-VOIC1342.0",
4
4
  "author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
5
5
  "contributors": [
6
6
  "Roman Zolotarov",