@onereach/step-voice 7.0.25-VOIC1709useridledetection.8 → 7.0.25
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.
- package/dst/Voice Agent.d.ts +1 -0
- package/dst/Voice Agent.js +10 -7
- package/package.json +1 -1
package/dst/Voice Agent.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export default class VoiceAgent extends VoiceStep<Partial<INPUT>> {
|
|
|
36
36
|
runStep(): Promise<void>;
|
|
37
37
|
private normalizeIdlePrompts;
|
|
38
38
|
private findExitByLabel;
|
|
39
|
+
private isStepFlagEnabled;
|
|
39
40
|
private isValidAgentUrl;
|
|
40
41
|
private buildAgentServiceConfig;
|
|
41
42
|
private parseAgentServiceOptions;
|
package/dst/Voice Agent.js
CHANGED
|
@@ -57,7 +57,7 @@ class VoiceAgent extends voice_1.default {
|
|
|
57
57
|
prevent_greeting_interruption,
|
|
58
58
|
tools
|
|
59
59
|
};
|
|
60
|
-
if (idle_detection_enabled) {
|
|
60
|
+
if (this.isStepFlagEnabled(idle_detection_enabled)) {
|
|
61
61
|
const timeoutSecs = Number(idle_timeout_secs);
|
|
62
62
|
const maxRetries = Number(idle_max_retries);
|
|
63
63
|
const prompts = this.normalizeIdlePrompts(idle_prompts);
|
|
@@ -70,13 +70,13 @@ class VoiceAgent extends voice_1.default {
|
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
let agentCustomUrl = '';
|
|
73
|
-
if (agent_url_overwritten) {
|
|
73
|
+
if (this.isStepFlagEnabled(agent_url_overwritten)) {
|
|
74
74
|
if (!this.isValidAgentUrl(agent_url)) {
|
|
75
75
|
this.throwError(new Error(`Voice Agent: invalid agent url "${agent_url}"`));
|
|
76
76
|
}
|
|
77
77
|
agentCustomUrl = agent_url;
|
|
78
78
|
}
|
|
79
|
-
if (custom_config_enabled) {
|
|
79
|
+
if (this.isStepFlagEnabled(custom_config_enabled)) {
|
|
80
80
|
config.mode = mode;
|
|
81
81
|
switch (mode) {
|
|
82
82
|
case "waterfall" /* AgentPipelineMode.WATERFALL */:
|
|
@@ -91,10 +91,10 @@ class VoiceAgent extends voice_1.default {
|
|
|
91
91
|
this.throwError(new Error(`Voice Agent: unknown mode "${mode}"`));
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
const params = {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
94
|
+
const params = { config };
|
|
95
|
+
if (agentCustomUrl) {
|
|
96
|
+
params.url = agentCustomUrl;
|
|
97
|
+
}
|
|
98
98
|
await this.sendCommands(call, [{ name: 'startAgent', params }]);
|
|
99
99
|
return this.exitFlow();
|
|
100
100
|
});
|
|
@@ -108,6 +108,9 @@ class VoiceAgent extends voice_1.default {
|
|
|
108
108
|
const exit = lodash_1.default.find(this.step.exits, (e) => e.label === label);
|
|
109
109
|
return exit?.id;
|
|
110
110
|
}
|
|
111
|
+
isStepFlagEnabled(value) {
|
|
112
|
+
return value === true || value === 'true';
|
|
113
|
+
}
|
|
111
114
|
isValidAgentUrl(value) {
|
|
112
115
|
return /^wss?:\/\/([a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+|\[[a-fA-F0-9:]+\])(:\d+)?(\/\S*)?$/.test(value);
|
|
113
116
|
}
|