@onereach/step-voice 7.0.9-processttschunk.18 → 7.0.9-processttschunk.20

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.
@@ -7,6 +7,9 @@ interface INPUT {
7
7
  voiceSettings: any;
8
8
  queryParams: any;
9
9
  minConfidence: number;
10
+ /** `true` → ElevenLabs stream (`playbackMode: 'chunks'`). `false` → synthesize + playback per phrase (`phrases`). */
11
+ chunksStreamingEnabled: boolean;
12
+ tts?: TODO;
10
13
  confirmationConfidence?: number;
11
14
  }
12
15
  interface EVENT extends VoiceEvent {
@@ -5,29 +5,43 @@ const voice_1 = tslib_1.__importDefault(require("./voice"));
5
5
  class StartTTSChunksProcessing extends voice_1.default {
6
6
  async runStep() {
7
7
  const call = await this.fetchData();
8
- const { voiceId, infiniteProcessing, asr, endpointing, minConfidence, confirmationConfidence, voiceSettings: getSettings, queryParams: getParams } = this.data;
8
+ const { voiceId, asr, endpointing, minConfidence, confirmationConfidence, voiceSettings: getSettings, queryParams: getParams, chunksStreamingEnabled, tts } = this.data;
9
9
  const grammar = {
10
10
  id: this.currentStepId,
11
11
  asr: {
12
12
  ...asr.getSettings(call.asr),
13
13
  config: {
14
- endpointing,
14
+ endpointing
15
15
  }
16
- },
16
+ }
17
17
  };
18
18
  const voiceSettings = await getSettings.call(this);
19
19
  const queryParams = await getParams.call(this);
20
- const command = {
21
- name: 'start-TTS-chunks-processing',
22
- params: {
20
+ const base = {
21
+ grammar,
22
+ minConfidence,
23
+ ...(confirmationConfidence !== undefined ? { confirmationConfidence } : {})
24
+ };
25
+ let params;
26
+ if (chunksStreamingEnabled) {
27
+ params = {
28
+ ...base,
29
+ playbackMode: 'chunks',
23
30
  voiceId,
24
- infiniteProcessing,
25
- grammar,
26
31
  voiceSettings,
27
- queryParams,
28
- minConfidence,
29
- confirmationConfidence
30
- }
32
+ queryParams
33
+ };
34
+ }
35
+ else {
36
+ params = {
37
+ ...base,
38
+ playbackMode: 'phrases',
39
+ phraseTtsSettings: tts.getSettings(call.tts)
40
+ };
41
+ }
42
+ const command = {
43
+ name: 'start-TTS-chunks-processing',
44
+ params
31
45
  };
32
46
  this.log.debug('StartTTSChunksProcessing command', { command });
33
47
  this.triggers.local(`in/voice/${call.id}`, async (event) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/step-voice",
3
- "version": "7.0.9-processttschunk.18",
3
+ "version": "7.0.9-processttschunk.20",
4
4
  "author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
5
5
  "contributors": [
6
6
  "Roman Zolotarov",