...
 
Commits (2)
......@@ -62,21 +62,23 @@ function createDetectStream() {
if (data.queryResult) {
shouldStream = true;
console.log(`Detected intent:`);
console.log(data.queryResult);
socketData = {
action: data.queryResult.parameters.fields.action.stringValue,
intent: data.queryResult.action,
queryText: data.queryResult.queryText
};
const stringifiedData = JSON.stringify(socketData);
if (ws) {
ws.send(stringifiedData);
console.log(`SocketData: ` + stringifiedData);
} else {
console.log(`SocketData: ` + stringifiedData);
if (data.queryResult.action !== '') {
console.log(`Detected intent:`);
console.log(data.queryResult);
socketData = {
action: data.queryResult.parameters.fields.action.stringValue,
intent: data.queryResult.action,
queryText: data.queryResult.queryText
};
const stringifiedData = JSON.stringify(socketData);
if (ws) {
ws.send(stringifiedData);
console.log(`SocketData: ` + stringifiedData);
} else {
console.log(`SocketData: ` + stringifiedData);
}
//console.log(`Parameters:` + data.queryResult.parameters.fields.action);
}
//console.log(`Parameters:` + data.queryResult.parameters.fields.action);
}
})
.on('end', (data) => {
......