wingbot 3.53.1 → 3.53.3
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 +8 -2
- package/src/Router.js +1 -3
- package/src/resolvers/message.js +3 -13
package/package.json
CHANGED
package/src/AiMatching.js
CHANGED
|
@@ -515,11 +515,17 @@ class AiMatching {
|
|
|
515
515
|
this._ai.confidence + this.redundantEntityHandicap
|
|
516
516
|
));
|
|
517
517
|
|
|
518
|
-
|
|
518
|
+
const remainingTextLen = (textLength - matchedEntitiesTextLength);
|
|
519
|
+
const minus = (remainingTextLen / textLength) * remainingScore;
|
|
520
|
+
|
|
521
|
+
// eslint-disable-next-line no-console,max-len,object-curly-newline
|
|
522
|
+
// console.log({ minus, matchedEntitiesTextLength, textLength, remainingScore })
|
|
523
|
+
|
|
524
|
+
finalScore -= minus;
|
|
519
525
|
}
|
|
520
526
|
|
|
521
527
|
// eslint-disable-next-line no-console,max-len,object-curly-newline
|
|
522
|
-
// console.log({ finalScore, rule, baseScore, score, allOptional, entities, reqEntities, matchedEntitiesTextLength, countOfAdditionalItems });
|
|
528
|
+
// console.log({ countOfAdditionalItems, multiMatch: this.multiMatchGain ** countOfAdditionalItems, handicap, finalScore, rule, baseScore, score, allOptional, entities, reqEntities, matchedEntitiesTextLength, countOfAdditionalItems });
|
|
523
529
|
|
|
524
530
|
if (finalScore <= 0) {
|
|
525
531
|
return null;
|
package/src/Router.js
CHANGED
|
@@ -14,9 +14,7 @@ function defaultPathContext () {
|
|
|
14
14
|
return { globalIntentsMeta: {}, path: '/*' };
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* @typedef {true|false|null|undefined|-1|void} RoutingInstruction
|
|
19
|
-
*/
|
|
17
|
+
/** @typedef {true|false|null|undefined|number|void} RoutingInstruction */
|
|
20
18
|
|
|
21
19
|
/**
|
|
22
20
|
* @callback PostBackDataCallback
|
package/src/resolvers/message.js
CHANGED
|
@@ -192,15 +192,9 @@ function selectTranslation (resolverId, params, texts, data) {
|
|
|
192
192
|
const key = `_R_${resolverId}`;
|
|
193
193
|
let { lang, [key]: seqState } = data;
|
|
194
194
|
|
|
195
|
-
if (texts.length
|
|
196
|
-
console.log('MSG0-P', params); // eslint-disable-line no-console
|
|
197
|
-
console.log('MSG0-D', { resolverId, texts }); // eslint-disable-line no-console
|
|
198
|
-
throw new Error(`Resolver ${resolverId} failed ${JSON.stringify(params.text).replace(/"([^"]+)":/g, '$1:')}`);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
if (texts.length === 1) {
|
|
195
|
+
if (texts.length <= 1) {
|
|
202
196
|
return [
|
|
203
|
-
renderMessageText(texts[0].t, data),
|
|
197
|
+
texts[0] ? renderMessageText(texts[0].t, data) : '',
|
|
204
198
|
seqState && resolverId
|
|
205
199
|
? vars.expiresAfter(key, null, 1)
|
|
206
200
|
: {}
|
|
@@ -226,11 +220,7 @@ function selectTranslation (resolverId, params, texts, data) {
|
|
|
226
220
|
const index = data._expandRandomTexts
|
|
227
221
|
? 1
|
|
228
222
|
: Math.floor(Math.random() * texts.length);
|
|
229
|
-
|
|
230
|
-
console.log('MSG-P', params); // eslint-disable-line no-console
|
|
231
|
-
console.log('MSG-D', { resolverId, texts }); // eslint-disable-line no-console
|
|
232
|
-
throw new Error(`Resolver ${resolverId} failed ${JSON.stringify(params.text).replace(/"([^"]+)":/g, '$1:')}`);
|
|
233
|
-
}
|
|
223
|
+
|
|
234
224
|
return [
|
|
235
225
|
renderMessageText(texts[index].t, data),
|
|
236
226
|
seqState
|