From 1529c72039092c7b8f37304d6064e04f2dc7b795 Mon Sep 17 00:00:00 2001 From: louistiti Date: Sun, 8 May 2022 22:16:06 +0800 Subject: [PATCH] feat(server): add handsigns custom entity --- core/data/en/entities/handsigns.json | 28 ++++++++++++++++++++++++++++ server/src/core/nlu.js | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 core/data/en/entities/handsigns.json diff --git a/core/data/en/entities/handsigns.json b/core/data/en/entities/handsigns.json new file mode 100644 index 00000000..eb578963 --- /dev/null +++ b/core/data/en/entities/handsigns.json @@ -0,0 +1,28 @@ +{ + "options": { + "rock": { + "synonyms": ["rock", "stone"], + "data": { + "value": [ + "ROCK" + ] + } + }, + "paper": { + "synonyms": ["paper"], + "data": { + "value": [ + "PAPER" + ] + } + }, + "scissors": { + "synonyms": ["scissors"], + "data": { + "value": [ + "SCISSORS" + ] + } + } + } +} diff --git a/server/src/core/nlu.js b/server/src/core/nlu.js index 72997a90..53ccb158 100644 --- a/server/src/core/nlu.js +++ b/server/src/core/nlu.js @@ -186,7 +186,7 @@ class Nlu { return resolve(null) } - if (processedData && Object.keys(processedData).length > 0) { + if (Object.keys(processedData).length > 0) { processedData.nextAction = 'guess' // Set new context with the next action if there is one if (processedData.nextAction) {