mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
minor rasa fix
This commit is contained in:
@@ -111,7 +111,9 @@ class Rasa extends Task {
|
|||||||
const response = await this.post(this.data.url, payload);
|
const response = await this.post(this.data.url, payload);
|
||||||
this.logger.debug({response}, 'Rasa:_onTranscription - got response from Rasa');
|
this.logger.debug({response}, 'Rasa:_onTranscription - got response from Rasa');
|
||||||
const botUtterance = Array.isArray(response) ?
|
const botUtterance = Array.isArray(response) ?
|
||||||
response.reduce((prev, current) => `${prev} ${current.text}`, '') :
|
response.reduce((prev, current) => {
|
||||||
|
return current.text ? `${prev} ${current.text}` : '';
|
||||||
|
}, '') :
|
||||||
null;
|
null;
|
||||||
if (botUtterance) {
|
if (botUtterance) {
|
||||||
this.logger.debug({botUtterance}, 'Rasa:_onTranscription: got user utterance');
|
this.logger.debug({botUtterance}, 'Rasa:_onTranscription: got user utterance');
|
||||||
@@ -119,7 +121,7 @@ class Rasa extends Task {
|
|||||||
this.gatherTask.exec(cs, ep, this)
|
this.gatherTask.exec(cs, ep, this)
|
||||||
.catch((err) => this.logger.info({err}, 'Rasa gather task returned error'));
|
.catch((err) => this.logger.info({err}, 'Rasa gather task returned error'));
|
||||||
if (this.eventHook) {
|
if (this.eventHook) {
|
||||||
this.performHook(cs, this.eventHook, {event: 'botMessage', message: botUtterance})
|
this.performHook(cs, this.eventHook, {event: 'botMessage', message: response})
|
||||||
.then((redirected) => {
|
.then((redirected) => {
|
||||||
if (redirected) {
|
if (redirected) {
|
||||||
this.logger.info('Rasa_onTranscription: event handler for bot message redirected us to new webhook');
|
this.logger.info('Rasa_onTranscription: event handler for bot message redirected us to new webhook');
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "jambonz-feature-server",
|
"name": "jambonz-feature-server",
|
||||||
"version": "0.3.1",
|
"version": "0.6.6",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 10.16.0"
|
"node": ">= 10.16.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user