wingbot 3.65.5 → 3.65.6
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.
- package/package.json +1 -1
- package/src/AiMatching.js +17 -17
package/package.json
CHANGED
package/src/AiMatching.js
CHANGED
|
@@ -461,6 +461,19 @@ class AiMatching {
|
|
|
461
461
|
const regexpScore = this._matchRegexp(req, regexps, noIntentHandicap);
|
|
462
462
|
const textLength = req.text().trim().length;
|
|
463
463
|
|
|
464
|
+
let useState;
|
|
465
|
+
if (stateless || intents.length === 0) {
|
|
466
|
+
useState = Object.entries(stateData(req))
|
|
467
|
+
.reduce((o, [k, v]) => {
|
|
468
|
+
if (k.startsWith('@')) {
|
|
469
|
+
return o;
|
|
470
|
+
}
|
|
471
|
+
return Object.assign(o, { [k]: v });
|
|
472
|
+
}, {});
|
|
473
|
+
} else {
|
|
474
|
+
useState = stateData(req);
|
|
475
|
+
}
|
|
476
|
+
|
|
464
477
|
if (regexpScore !== 0 || (intents.length === 0 && regexps.length === 0)) {
|
|
465
478
|
|
|
466
479
|
if (entities.length === 0) {
|
|
@@ -475,19 +488,6 @@ class AiMatching {
|
|
|
475
488
|
};
|
|
476
489
|
}
|
|
477
490
|
|
|
478
|
-
let useState;
|
|
479
|
-
if (stateless || intents.length === 0) {
|
|
480
|
-
useState = Object.entries(stateData(req))
|
|
481
|
-
.reduce((o, [k, v]) => {
|
|
482
|
-
if (k.startsWith('@')) {
|
|
483
|
-
return o;
|
|
484
|
-
}
|
|
485
|
-
return Object.assign(o, { [k]: v });
|
|
486
|
-
}, {});
|
|
487
|
-
} else {
|
|
488
|
-
useState = stateData(req);
|
|
489
|
-
}
|
|
490
|
-
|
|
491
491
|
const {
|
|
492
492
|
score, handicap, matched, metl
|
|
493
493
|
} = this
|
|
@@ -561,7 +561,7 @@ class AiMatching {
|
|
|
561
561
|
requestIntent,
|
|
562
562
|
entities,
|
|
563
563
|
req,
|
|
564
|
-
|
|
564
|
+
useState
|
|
565
565
|
);
|
|
566
566
|
|
|
567
567
|
if (score > max) {
|
|
@@ -594,7 +594,7 @@ class AiMatching {
|
|
|
594
594
|
* @param {Intent} requestIntent
|
|
595
595
|
* @param {EntityExpression[]} wantedEntities
|
|
596
596
|
* @param {AIRequest} req
|
|
597
|
-
* @param {
|
|
597
|
+
* @param {object} useState
|
|
598
598
|
* @returns {{score:number,entities:Entity[]}}
|
|
599
599
|
*/
|
|
600
600
|
_intentMatchingScore (
|
|
@@ -603,7 +603,7 @@ class AiMatching {
|
|
|
603
603
|
requestIntent,
|
|
604
604
|
wantedEntities,
|
|
605
605
|
req,
|
|
606
|
-
|
|
606
|
+
useState
|
|
607
607
|
) {
|
|
608
608
|
if (wantedIntent !== requestIntent.intent) {
|
|
609
609
|
return { score: 0, entities: [] };
|
|
@@ -625,7 +625,7 @@ class AiMatching {
|
|
|
625
625
|
textLength,
|
|
626
626
|
wantedEntities,
|
|
627
627
|
useEntities,
|
|
628
|
-
|
|
628
|
+
useState,
|
|
629
629
|
requestIntent.entities
|
|
630
630
|
? (x) => Math.atan((x - 0.76) * 40) / Math.atan((1 - 0.76) * 40)
|
|
631
631
|
: (x) => x,
|