wingbot 3.67.14 → 3.67.16

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wingbot",
3
- "version": "3.67.14",
3
+ "version": "3.67.16",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
package/src/Responder.js CHANGED
@@ -247,7 +247,10 @@ class Responder {
247
247
  limit,
248
248
  onlyFlag
249
249
  );
250
- const { responseTexts = [] } = chatLogStorage;
250
+ const { responseTexts = [], requestTexts = [] } = this._messageSender;
251
+ transcript.push(...requestTexts.map((text) => ({
252
+ fromBot: false, text
253
+ })));
251
254
  transcript.push(...responseTexts.map((text) => ({
252
255
  fromBot: true, text
253
256
  })));
@@ -212,6 +212,25 @@ class ReturnSender {
212
212
  return this._simulatesOptIn;
213
213
  }
214
214
 
215
+ /**
216
+ * @returns {string[]}
217
+ */
218
+ get requestTexts () {
219
+ const text = extractText(this._incommingMessage);
220
+
221
+ if (!text) {
222
+ return [];
223
+ }
224
+
225
+ const filter = this._confidentInput
226
+ ? this.confidentInputFilter
227
+ : this.textFilter;
228
+
229
+ return [
230
+ filter(text).trim()
231
+ ];
232
+ }
233
+
215
234
  /**
216
235
  * @returns {string[]}
217
236
  */
@@ -156,9 +156,8 @@ function relativeLevenshtein (
156
156
 
157
157
  const leftNum = left.replace(/[^0-9]+/g, '');
158
158
  const rightNum = right.replace(/[^0-9]+/g, '');
159
- const numLen = leftNum.length ? leftNum.length * NUMERIC_KOEF : rightNum.length;
160
- const useNumK = leftNum.length ? NUMERIC_KOEF : 1;
161
- const numLev = numLen ? levenshtein(leftNum, rightNum) * useNumK : 0;
159
+ const numLen = Math.max(leftNum.length, rightNum.length);
160
+ const numLev = numLen ? levenshtein(leftNum, rightNum) * NUMERIC_KOEF : 0;
162
161
 
163
162
  if (stemLen < 3) {
164
163
  return addSeed(seed, len + numLen, levenshtein(left, right) + numLev) * wordHandicap;
@@ -190,7 +189,6 @@ function relativeLevenshtein (
190
189
 
191
190
  const r = (vStem + vSuffix) * wordHandicap;
192
191
 
193
- // console.log(`#levenshtein "${left}" <- ${right}: ${r.toFixed(3)}`);
194
192
  return r;
195
193
  }
196
194