@onereach/step-voice 7.0.9-processttschunk.27 → 7.0.9-processttschunk.28

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.
@@ -3,6 +3,7 @@ interface INPUT {
3
3
  textChunk: string;
4
4
  isFinal: boolean;
5
5
  flush?: boolean;
6
+ hangupAfterPlayback?: boolean;
6
7
  ttsContext: any;
7
8
  }
8
9
  interface EVENT extends VoiceEvent {
@@ -5,7 +5,7 @@ const voice_1 = tslib_1.__importDefault(require("./voice"));
5
5
  class ProcessTtsChunk extends voice_1.default {
6
6
  async runStep() {
7
7
  const call = await this.fetchData();
8
- const { textChunk, isFinal, flush, ttsContext: getTtsContext } = this.data;
8
+ const { textChunk, isFinal, flush, hangupAfterPlayback, ttsContext: getTtsContext } = this.data;
9
9
  const ttsContext = await getTtsContext.call(this);
10
10
  const command = {
11
11
  name: 'process-tts-chunk',
@@ -13,6 +13,7 @@ class ProcessTtsChunk extends voice_1.default {
13
13
  chunk: textChunk,
14
14
  isFinal,
15
15
  flush,
16
+ hangupAfterPlayback: Boolean(hangupAfterPlayback),
16
17
  ttsContext
17
18
  }
18
19
  };
@@ -25,9 +26,9 @@ class ProcessTtsChunk extends voice_1.default {
25
26
  if (textChunk) {
26
27
  call.ttsTranscriptBuffer = (call.ttsTranscriptBuffer ?? '') + textChunk;
27
28
  }
28
- // A chunk series ends on `flush` (or the terminal `isFinal`); emit the
29
- // accumulated bot speech as a single transcript event and start a new series.
30
- if (flush || isFinal) {
29
+ // A chunk series ends on `flush` (or the terminal `isFinal` / hangupAfterPlayback);
30
+ // emit the accumulated bot speech as a single transcript event and start a new series.
31
+ if (flush || isFinal || hangupAfterPlayback) {
31
32
  const message = (call.ttsTranscriptBuffer ?? '').trim();
32
33
  call.ttsTranscriptBuffer = '';
33
34
  if (message) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/step-voice",
3
- "version": "7.0.9-processttschunk.27",
3
+ "version": "7.0.9-processttschunk.28",
4
4
  "author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
5
5
  "contributors": [
6
6
  "Roman Zolotarov",