wingbot 3.26.1 → 3.26.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/AiMatching.js +17 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wingbot",
3
- "version": "3.26.1",
3
+ "version": "3.26.2",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/AiMatching.js CHANGED
@@ -403,13 +403,27 @@ class AiMatching {
403
403
  score: regexpScore - handicap
404
404
  };
405
405
  }
406
+
407
+ let useState;
408
+ if (stateless) {
409
+ useState = {};
410
+ } else if (intents.length === 0) {
411
+ useState = Object.entries(req.state)
412
+ .reduce((o, [k, v]) => {
413
+ if (k.startsWith('@')) {
414
+ return o;
415
+ }
416
+ return Object.assign(o, { [k]: v });
417
+ }, {});
418
+ } else {
419
+ useState = req.state;
420
+ }
421
+
406
422
  const { score, handicap, matched } = this
407
423
  ._entityMatching(
408
424
  entities,
409
425
  reqEntities,
410
- stateless || intents.length === 0
411
- ? {}
412
- : req.state
426
+ useState
413
427
  );
414
428
 
415
429
  const allOptional = entities.every((e) => e.optional);