@onereach/step-voice 7.0.2-initaiconversation.9 → 7.0.2-processttschunk.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.
@@ -1,6 +1,7 @@
1
1
  import VoiceStep, { VoiceEvent } from './voice';
2
2
  interface INPUT {
3
3
  textChunk: string;
4
+ isFinal: boolean;
4
5
  }
5
6
  interface EVENT extends VoiceEvent {
6
7
  exitId?: string;
@@ -5,11 +5,12 @@ 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 chunk = this.data.textChunk;
8
+ const { textChunk, isFinal } = this.data;
9
9
  const command = {
10
10
  name: 'process-tts-chunk',
11
11
  params: {
12
- chunk
12
+ chunk: textChunk,
13
+ isFinal
13
14
  }
14
15
  };
15
16
  const sensitiveData = {
@@ -22,7 +23,7 @@ class ProcessTtsChunk extends voice_1.default {
22
23
  });
23
24
  this.triggers.otherwise(async () => {
24
25
  await this.pauseRecording(call, command, sensitiveData);
25
- return this.exitFlow();
26
+ this.exitStep('next');
26
27
  });
27
28
  }
28
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/step-voice",
3
- "version": "7.0.2-initaiconversation.9",
3
+ "version": "7.0.2-processttschunk.0",
4
4
  "author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
5
5
  "contributors": [
6
6
  "Roman Zolotarov",
@@ -1,18 +0,0 @@
1
- import VoiceStep, { VoiceEvent } from './voice';
2
- interface INPUT {
3
- instructions: string;
4
- temperature: number;
5
- modality: 'audio' | 'text';
6
- threshold: number;
7
- prefixPadding: number;
8
- silenceDuration: number;
9
- language: string;
10
- voice?: string;
11
- }
12
- interface EVENT extends VoiceEvent {
13
- exitId?: string;
14
- }
15
- export default class InitAIConversation extends VoiceStep<INPUT, {}, EVENT> {
16
- runStep(): Promise<void>;
17
- }
18
- export {};
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const voice_1 = tslib_1.__importDefault(require("./voice"));
5
- class InitAIConversation extends voice_1.default {
6
- async runStep() {
7
- const call = await this.fetchData();
8
- const { instructions, temperature, modality, threshold, prefixPadding, silenceDuration, language, voice } = this.data;
9
- const asrSettings = {
10
- enabled: true,
11
- engine: `openAI`,
12
- config: {
13
- instructions,
14
- temperature,
15
- modality,
16
- threshold,
17
- prefixPadding,
18
- silenceDuration,
19
- language,
20
- voice
21
- }
22
- };
23
- const grammar = {
24
- id: this.currentStepId,
25
- asr: asrSettings
26
- };
27
- const command = {
28
- name: 'init-ai-conversation',
29
- params: {
30
- grammar,
31
- }
32
- };
33
- const sensitiveData = {
34
- muteStep: false,
35
- muteUser: false,
36
- muteBot: false,
37
- };
38
- this.triggers.local(`in/voice/${call.id}`, async (event) => {
39
- this.log.info('Received event from voicer', event);
40
- });
41
- this.triggers.otherwise(async () => {
42
- await this.pauseRecording(call, command, sensitiveData);
43
- return this.exitFlow();
44
- });
45
- }
46
- }
47
- exports.default = InitAIConversation;