diff --git a/lib/tasks/dialogflow/index.js b/lib/tasks/dialogflow/index.js index a765b7f5..7efe178d 100644 --- a/lib/tasks/dialogflow/index.js +++ b/lib/tasks/dialogflow/index.js @@ -15,8 +15,7 @@ class Dialogflow extends Task { this.agent = this.data.agent; this.region = this.data.region || 'default'; this.model = this.data.model || 'es'; - this.cmd = this.model === 'cx' ? 'dialogflow_cx_start' : 'dialogflow_start'; - this.cmdStop = this.model === 'cx' ? 'dialogflow_cx_stop' : 'dialogflow_stop'; + this.queryInput = this.data.queryInput || {}; assert(this.agent || !this.isCX, 'agent is required for dialogflow cx'); assert(this.credentials, 'dialogflow credentials are required'); @@ -76,6 +75,9 @@ class Dialogflow extends Task { this.fallbackLabel = this.data.tts.fallbackLabel; } 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; } @@ -184,10 +186,10 @@ class Dialogflow extends Task { this.environment, this.lang, ]; - if (this.welcomeEvent) { - baseArgs.push(this.welcomeEvent); + if (Object.keys(this.queryInput).length > 0) { + baseArgs.push(`'${JSON.stringify(this.queryInput)}'`); } - await this.ep.api(this.cmd, `${baseArgs.join(' ')}`) + await this.ep.api(this.cmd, `${baseArgs.join(' ')}`); } /** diff --git a/package-lock.json b/package-lock.json index 65a66479..21b15a5e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "@jambonz/speech-utils": "^0.1.15", "@jambonz/stats-collector": "^0.1.10", "@jambonz/time-series": "^0.2.9", - "@jambonz/verb-specifications": "^0.0.77", + "@jambonz/verb-specifications": "^0.0.79", "@opentelemetry/api": "^1.8.0", "@opentelemetry/exporter-jaeger": "^1.23.0", "@opentelemetry/exporter-trace-otlp-http": "^0.50.0", @@ -1575,9 +1575,9 @@ } }, "node_modules/@jambonz/verb-specifications": { - "version": "0.0.77", - "resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.77.tgz", - "integrity": "sha512-reGTuBmxiiCo4eCWAtHOBT+Dm6OxZ8d2Yb9J/3scQ92oT+UHFO3U3gutEUH0qjdZAn3ogCkSmWABWn6LEqhqaA==", + "version": "0.0.79", + "resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.79.tgz", + "integrity": "sha512-SJpUfRivPaBBF16sUhkKPuXC4KFf2vE03LuSNYGhtjzZ03PnIGXbsuz16cK+XeQow5tkof+ptmxwFgfv6TM5RQ==", "dependencies": { "debug": "^4.3.4", "pino": "^8.8.0" @@ -10539,9 +10539,9 @@ } }, "@jambonz/verb-specifications": { - "version": "0.0.77", - "resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.77.tgz", - "integrity": "sha512-reGTuBmxiiCo4eCWAtHOBT+Dm6OxZ8d2Yb9J/3scQ92oT+UHFO3U3gutEUH0qjdZAn3ogCkSmWABWn6LEqhqaA==", + "version": "0.0.79", + "resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.79.tgz", + "integrity": "sha512-SJpUfRivPaBBF16sUhkKPuXC4KFf2vE03LuSNYGhtjzZ03PnIGXbsuz16cK+XeQow5tkof+ptmxwFgfv6TM5RQ==", "requires": { "debug": "^4.3.4", "pino": "^8.8.0" diff --git a/package.json b/package.json index 3537d2db..a85757db 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "@jambonz/speech-utils": "^0.1.15", "@jambonz/stats-collector": "^0.1.10", "@jambonz/time-series": "^0.2.9", - "@jambonz/verb-specifications": "^0.0.77", + "@jambonz/verb-specifications": "^0.0.79", "@opentelemetry/api": "^1.8.0", "@opentelemetry/exporter-jaeger": "^1.23.0", "@opentelemetry/exporter-trace-otlp-http": "^0.50.0",