wingbot 3.65.7 → 3.65.9
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
CHANGED
package/src/AiMatching.js
CHANGED
|
@@ -183,6 +183,12 @@ class AiMatching {
|
|
|
183
183
|
*/
|
|
184
184
|
this.stateEntityScore = 1;
|
|
185
185
|
|
|
186
|
+
/**
|
|
187
|
+
* Score of matched regexp
|
|
188
|
+
* (1.02 by default)
|
|
189
|
+
*/
|
|
190
|
+
this.regexpScore = 1.02;
|
|
191
|
+
|
|
186
192
|
this._ai = ai;
|
|
187
193
|
}
|
|
188
194
|
|
|
@@ -901,7 +907,9 @@ class AiMatching {
|
|
|
901
907
|
return 0;
|
|
902
908
|
}
|
|
903
909
|
|
|
904
|
-
return f
|
|
910
|
+
return f
|
|
911
|
+
? this.regexpScore
|
|
912
|
+
: this.regexpScore - noIntentHandicap;
|
|
905
913
|
});
|
|
906
914
|
|
|
907
915
|
return Math.max(0, ...scores);
|
|
@@ -536,68 +536,72 @@ function onInteractionHandler (
|
|
|
536
536
|
}))
|
|
537
537
|
);
|
|
538
538
|
|
|
539
|
-
|
|
539
|
+
const skipThisInteraction = responseTexts.length === 0 && nonInteractive;
|
|
540
|
+
|
|
541
|
+
if (!skipThisInteraction) {
|
|
542
|
+
if (req.isText()) {
|
|
543
|
+
trackEvents.push({
|
|
544
|
+
type: TrackingType.TRAINING,
|
|
545
|
+
// @ts-ignore
|
|
546
|
+
lastAction,
|
|
547
|
+
category: asCategory(TrackingCategory.INTENT_DETECTION),
|
|
548
|
+
intent,
|
|
549
|
+
action,
|
|
550
|
+
label: text,
|
|
551
|
+
value: score >= ai.confidence ? 0 : 1,
|
|
552
|
+
...langsExtension
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
let actionCategory;
|
|
557
|
+
let label = noneAction;
|
|
558
|
+
|
|
559
|
+
if (isPassThread) {
|
|
560
|
+
actionCategory = TrackingCategory.HANDOVER_TO_BOT;
|
|
561
|
+
} else if (req.isSticker()) {
|
|
562
|
+
actionCategory = TrackingCategory.STICKER;
|
|
563
|
+
label = req.attachmentUrl(0);
|
|
564
|
+
} else if (req.isImage()) {
|
|
565
|
+
actionCategory = TrackingCategory.IMAGE;
|
|
566
|
+
label = req.attachmentUrl(0);
|
|
567
|
+
} else if (req.hasLocation()) {
|
|
568
|
+
actionCategory = TrackingCategory.LOCATION;
|
|
569
|
+
const { lat, long } = req.getLocation();
|
|
570
|
+
label = `${lat}, ${long}`;
|
|
571
|
+
} else if (isAttachment) {
|
|
572
|
+
actionCategory = TrackingCategory.ATTACHMENT;
|
|
573
|
+
label = req.attachment(0).type;
|
|
574
|
+
} else if (isText) {
|
|
575
|
+
actionCategory = TrackingCategory.TEXT;
|
|
576
|
+
label = text;
|
|
577
|
+
} else if (isQuickReply) {
|
|
578
|
+
actionCategory = TrackingCategory.QUICK_REPLY;
|
|
579
|
+
label = text;
|
|
580
|
+
} else if (req.isOptin()) {
|
|
581
|
+
actionCategory = TrackingCategory.OPT_IN;
|
|
582
|
+
} else if (req.isReferral()) {
|
|
583
|
+
actionCategory = TrackingCategory.REFERRAL;
|
|
584
|
+
} else if (isPostback) {
|
|
585
|
+
actionCategory = TrackingCategory.POSTBACK_BUTTON;
|
|
586
|
+
label = req.event.postback.title || (useExtendedScalars ? null : '(unknown)');
|
|
587
|
+
} else {
|
|
588
|
+
actionCategory = TrackingCategory.OTHER;
|
|
589
|
+
}
|
|
590
|
+
|
|
540
591
|
trackEvents.push({
|
|
541
|
-
|
|
542
|
-
|
|
592
|
+
...(analyticsStorage.hasExtendedEvents ? actionMeta : {}),
|
|
593
|
+
type: TrackingType.CONVERSATION_EVENT,
|
|
543
594
|
lastAction,
|
|
544
|
-
category: asCategory(
|
|
545
|
-
intent,
|
|
595
|
+
category: asCategory(actionCategory),
|
|
546
596
|
action,
|
|
547
|
-
label
|
|
548
|
-
value
|
|
597
|
+
label,
|
|
598
|
+
value,
|
|
599
|
+
pageCategory,
|
|
600
|
+
nonInteractive,
|
|
549
601
|
...langsExtension
|
|
550
602
|
});
|
|
551
603
|
}
|
|
552
604
|
|
|
553
|
-
let actionCategory;
|
|
554
|
-
let label = noneAction;
|
|
555
|
-
|
|
556
|
-
if (isPassThread) {
|
|
557
|
-
actionCategory = TrackingCategory.HANDOVER_TO_BOT;
|
|
558
|
-
} else if (req.isSticker()) {
|
|
559
|
-
actionCategory = TrackingCategory.STICKER;
|
|
560
|
-
label = req.attachmentUrl(0);
|
|
561
|
-
} else if (req.isImage()) {
|
|
562
|
-
actionCategory = TrackingCategory.IMAGE;
|
|
563
|
-
label = req.attachmentUrl(0);
|
|
564
|
-
} else if (req.hasLocation()) {
|
|
565
|
-
actionCategory = TrackingCategory.LOCATION;
|
|
566
|
-
const { lat, long } = req.getLocation();
|
|
567
|
-
label = `${lat}, ${long}`;
|
|
568
|
-
} else if (isAttachment) {
|
|
569
|
-
actionCategory = TrackingCategory.ATTACHMENT;
|
|
570
|
-
label = req.attachment(0).type;
|
|
571
|
-
} else if (isText) {
|
|
572
|
-
actionCategory = TrackingCategory.TEXT;
|
|
573
|
-
label = text;
|
|
574
|
-
} else if (isQuickReply) {
|
|
575
|
-
actionCategory = TrackingCategory.QUICK_REPLY;
|
|
576
|
-
label = text;
|
|
577
|
-
} else if (req.isOptin()) {
|
|
578
|
-
actionCategory = TrackingCategory.OPT_IN;
|
|
579
|
-
} else if (req.isReferral()) {
|
|
580
|
-
actionCategory = TrackingCategory.REFERRAL;
|
|
581
|
-
} else if (isPostback) {
|
|
582
|
-
actionCategory = TrackingCategory.POSTBACK_BUTTON;
|
|
583
|
-
label = req.event.postback.title || (useExtendedScalars ? null : '(unknown)');
|
|
584
|
-
} else {
|
|
585
|
-
actionCategory = TrackingCategory.OTHER;
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
trackEvents.push({
|
|
589
|
-
...(analyticsStorage.hasExtendedEvents ? actionMeta : {}),
|
|
590
|
-
type: TrackingType.CONVERSATION_EVENT,
|
|
591
|
-
lastAction,
|
|
592
|
-
category: asCategory(actionCategory),
|
|
593
|
-
action,
|
|
594
|
-
label,
|
|
595
|
-
value,
|
|
596
|
-
pageCategory,
|
|
597
|
-
nonInteractive,
|
|
598
|
-
...langsExtension
|
|
599
|
-
});
|
|
600
|
-
|
|
601
605
|
await Promise.all([
|
|
602
606
|
analyticsStorage.storeEvents(
|
|
603
607
|
pageId,
|