wingbot 3.67.25 → 3.67.27
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/ChatGpt.js +1 -1
- package/src/Responder.js +11 -8
- package/src/analytics/onInteractionHandler.js +4 -4
package/package.json
CHANGED
package/src/ChatGpt.js
CHANGED
|
@@ -221,7 +221,7 @@ class ChatGpt {
|
|
|
221
221
|
anonymize = true
|
|
222
222
|
) {
|
|
223
223
|
const onlyFlag = Math.sign(limit) === -1 ? 'gpt' : null;
|
|
224
|
-
const transcript = await res.getTranscript(Math.abs(limit), onlyFlag);
|
|
224
|
+
const transcript = await res.getTranscript(Math.abs(limit), onlyFlag, true);
|
|
225
225
|
|
|
226
226
|
if (!anonymize) {
|
|
227
227
|
return transcript;
|
package/src/Responder.js
CHANGED
|
@@ -233,9 +233,10 @@ class Responder {
|
|
|
233
233
|
*
|
|
234
234
|
* @param {number} [limit]
|
|
235
235
|
* @param {string} [onlyFlag]
|
|
236
|
+
* @param {boolean} [skipThisTurnaround]
|
|
236
237
|
* @returns {Promise<Transcript[]>}
|
|
237
238
|
*/
|
|
238
|
-
async getTranscript (limit = 10, onlyFlag = null) {
|
|
239
|
+
async getTranscript (limit = 10, onlyFlag = null, skipThisTurnaround = false) {
|
|
239
240
|
const { chatLogStorage } = this._messageSender;
|
|
240
241
|
if (!chatLogStorage) {
|
|
241
242
|
return [];
|
|
@@ -247,13 +248,15 @@ class Responder {
|
|
|
247
248
|
limit,
|
|
248
249
|
onlyFlag
|
|
249
250
|
);
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
251
|
+
if (!skipThisTurnaround) {
|
|
252
|
+
const { responseTexts = [], requestTexts = [] } = this._messageSender;
|
|
253
|
+
transcript.push(...requestTexts.map((text) => ({
|
|
254
|
+
fromBot: false, text
|
|
255
|
+
})));
|
|
256
|
+
transcript.push(...responseTexts.map((text) => ({
|
|
257
|
+
fromBot: true, text
|
|
258
|
+
})));
|
|
259
|
+
}
|
|
257
260
|
return transcript;
|
|
258
261
|
}
|
|
259
262
|
|
|
@@ -275,7 +275,7 @@ function onInteractionHandler (
|
|
|
275
275
|
req,
|
|
276
276
|
actions,
|
|
277
277
|
lastAction,
|
|
278
|
-
|
|
278
|
+
state,
|
|
279
279
|
// data,
|
|
280
280
|
skill,
|
|
281
281
|
prevSkill,
|
|
@@ -305,14 +305,14 @@ function onInteractionHandler (
|
|
|
305
305
|
lang,
|
|
306
306
|
[pagePathVar]: pagePath,
|
|
307
307
|
[userAgentVar]: userAgent
|
|
308
|
-
} =
|
|
308
|
+
} = state;
|
|
309
309
|
|
|
310
310
|
const customDimensions = {};
|
|
311
311
|
for (let i = 1; i <= 8; i++) {
|
|
312
312
|
const k = `cd${i}`;
|
|
313
|
-
if (!['undefined', 'object'].includes(typeof
|
|
313
|
+
if (!['undefined', 'object'].includes(typeof state[k])) {
|
|
314
314
|
Object.assign(customDimensions, {
|
|
315
|
-
[k]:
|
|
315
|
+
[k]: state[k]
|
|
316
316
|
});
|
|
317
317
|
}
|
|
318
318
|
}
|