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.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(' ')}`);
}
/**