This commit is contained in:
Dave Horton
2024-08-20 21:02:20 -04:00
parent 3d7ba0ba0a
commit 731d36b047
3 changed files with 15 additions and 13 deletions

View File

@@ -15,8 +15,7 @@ class Dialogflow extends Task {
this.agent = this.data.agent; this.agent = this.data.agent;
this.region = this.data.region || 'default'; this.region = this.data.region || 'default';
this.model = this.data.model || 'es'; this.model = this.data.model || 'es';
this.cmd = this.model === 'cx' ? 'dialogflow_cx_start' : 'dialogflow_start'; this.queryInput = this.data.queryInput || {};
this.cmdStop = this.model === 'cx' ? 'dialogflow_cx_stop' : 'dialogflow_stop';
assert(this.agent || !this.isCX, 'agent is required for dialogflow cx'); assert(this.agent || !this.isCX, 'agent is required for dialogflow cx');
assert(this.credentials, 'dialogflow credentials are required'); assert(this.credentials, 'dialogflow credentials are required');
@@ -76,6 +75,9 @@ class Dialogflow extends Task {
this.fallbackLabel = this.data.tts.fallbackLabel; this.fallbackLabel = this.data.tts.fallbackLabel;
} }
this.bargein = this.data.bargein; this.bargein = this.data.bargein;
this.cmd = this.model === 'cx' ? 'dialogflow_cx_start' : 'dialogflow_start';
this.cmdStop = this.model === 'cx' ? 'dialogflow_cx_stop' : 'dialogflow_stop';
} }
get name() { return TaskName.Dialogflow; } get name() { return TaskName.Dialogflow; }
@@ -184,10 +186,10 @@ class Dialogflow extends Task {
this.environment, this.environment,
this.lang, this.lang,
]; ];
if (this.welcomeEvent) { if (Object.keys(this.queryInput).length > 0) {
baseArgs.push(this.welcomeEvent); baseArgs.push(`'${JSON.stringify(this.queryInput)}'`);
} }
await this.ep.api(this.cmd, `${baseArgs.join(' ')}`) await this.ep.api(this.cmd, `${baseArgs.join(' ')}`);
} }
/** /**

14
package-lock.json generated
View File

@@ -18,7 +18,7 @@
"@jambonz/speech-utils": "^0.1.15", "@jambonz/speech-utils": "^0.1.15",
"@jambonz/stats-collector": "^0.1.10", "@jambonz/stats-collector": "^0.1.10",
"@jambonz/time-series": "^0.2.9", "@jambonz/time-series": "^0.2.9",
"@jambonz/verb-specifications": "^0.0.77", "@jambonz/verb-specifications": "^0.0.79",
"@opentelemetry/api": "^1.8.0", "@opentelemetry/api": "^1.8.0",
"@opentelemetry/exporter-jaeger": "^1.23.0", "@opentelemetry/exporter-jaeger": "^1.23.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.50.0", "@opentelemetry/exporter-trace-otlp-http": "^0.50.0",
@@ -1575,9 +1575,9 @@
} }
}, },
"node_modules/@jambonz/verb-specifications": { "node_modules/@jambonz/verb-specifications": {
"version": "0.0.77", "version": "0.0.79",
"resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.77.tgz", "resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.79.tgz",
"integrity": "sha512-reGTuBmxiiCo4eCWAtHOBT+Dm6OxZ8d2Yb9J/3scQ92oT+UHFO3U3gutEUH0qjdZAn3ogCkSmWABWn6LEqhqaA==", "integrity": "sha512-SJpUfRivPaBBF16sUhkKPuXC4KFf2vE03LuSNYGhtjzZ03PnIGXbsuz16cK+XeQow5tkof+ptmxwFgfv6TM5RQ==",
"dependencies": { "dependencies": {
"debug": "^4.3.4", "debug": "^4.3.4",
"pino": "^8.8.0" "pino": "^8.8.0"
@@ -10539,9 +10539,9 @@
} }
}, },
"@jambonz/verb-specifications": { "@jambonz/verb-specifications": {
"version": "0.0.77", "version": "0.0.79",
"resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.77.tgz", "resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.79.tgz",
"integrity": "sha512-reGTuBmxiiCo4eCWAtHOBT+Dm6OxZ8d2Yb9J/3scQ92oT+UHFO3U3gutEUH0qjdZAn3ogCkSmWABWn6LEqhqaA==", "integrity": "sha512-SJpUfRivPaBBF16sUhkKPuXC4KFf2vE03LuSNYGhtjzZ03PnIGXbsuz16cK+XeQow5tkof+ptmxwFgfv6TM5RQ==",
"requires": { "requires": {
"debug": "^4.3.4", "debug": "^4.3.4",
"pino": "^8.8.0" "pino": "^8.8.0"

View File

@@ -34,7 +34,7 @@
"@jambonz/speech-utils": "^0.1.15", "@jambonz/speech-utils": "^0.1.15",
"@jambonz/stats-collector": "^0.1.10", "@jambonz/stats-collector": "^0.1.10",
"@jambonz/time-series": "^0.2.9", "@jambonz/time-series": "^0.2.9",
"@jambonz/verb-specifications": "^0.0.77", "@jambonz/verb-specifications": "^0.0.79",
"@opentelemetry/api": "^1.8.0", "@opentelemetry/api": "^1.8.0",
"@opentelemetry/exporter-jaeger": "^1.23.0", "@opentelemetry/exporter-jaeger": "^1.23.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.50.0", "@opentelemetry/exporter-trace-otlp-http": "^0.50.0",