fix(whatsapp.gblib): Fix PRIVACY_STORE_MESSAGES param.
This commit is contained in:
parent
b301b238ff
commit
99b5b8ba8b
4 changed files with 43 additions and 38 deletions
|
@ -1272,6 +1272,7 @@ export class GBConversationalService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (process.env.PRIVACY_STORE_MESSAGES === 'true') {
|
||||||
const analytics = new AnalyticsService();
|
const analytics = new AnalyticsService();
|
||||||
const conversation = null;
|
const conversation = null;
|
||||||
if (!user.conversationId) {
|
if (!user.conversationId) {
|
||||||
|
@ -1279,7 +1280,7 @@ export class GBConversationalService {
|
||||||
user.conversationId = conversation.conversationId;
|
user.conversationId = conversation.conversationId;
|
||||||
}
|
}
|
||||||
analytics.createMessage(min.instance.instanceId, conversation, null, text);
|
analytics.createMessage(min.instance.instanceId, conversation, null, text);
|
||||||
|
}
|
||||||
if (!step && member && !isNaN(member.id) && !member.id.startsWith('1000')) {
|
if (!step && member && !isNaN(member.id) && !member.id.startsWith('1000')) {
|
||||||
const to = step.context.activity.group ? step.context.activity.group : member.id;
|
const to = step.context.activity.group ? step.context.activity.group : member.id;
|
||||||
|
|
||||||
|
|
|
@ -1034,12 +1034,12 @@ export class GBMinService {
|
||||||
|
|
||||||
if (context.activity.from.id !== min.botId) {
|
if (context.activity.from.id !== min.botId) {
|
||||||
// Creates a new row in user table if it does not exists.
|
// Creates a new row in user table if it does not exists.
|
||||||
|
if (process.env.PRIVACY_STORE_MESSAGES === 'true') {
|
||||||
// Stores conversation associated to the user to group each message.
|
// Stores conversation associated to the user to group each message.
|
||||||
|
|
||||||
const analytics = new AnalyticsService();
|
const analytics = new AnalyticsService();
|
||||||
await analytics.createConversation(user);
|
await analytics.createConversation(user);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await sec.updateConversationReferenceById(userId, conversationReference);
|
await sec.updateConversationReferenceById(userId, conversationReference);
|
||||||
|
@ -1409,8 +1409,10 @@ export class GBMinService {
|
||||||
const userId = user.userId;
|
const userId = user.userId;
|
||||||
const params = user.params ? JSON.parse(user.params) : {};
|
const params = user.params ? JSON.parse(user.params) : {};
|
||||||
|
|
||||||
|
|
||||||
let message: GuaribasConversationMessage;
|
let message: GuaribasConversationMessage;
|
||||||
if (process.env.PRIVACY_STORE_MESSAGES === 'true') {
|
if (process.env.PRIVACY_STORE_MESSAGES === 'true') {
|
||||||
|
|
||||||
// Adds message to the analytics layer.
|
// Adds message to the analytics layer.
|
||||||
|
|
||||||
const analytics = new AnalyticsService();
|
const analytics = new AnalyticsService();
|
||||||
|
|
|
@ -264,16 +264,19 @@ export class FeedbackDialog extends IGBDialog {
|
||||||
async step => {
|
async step => {
|
||||||
const fixedLocale = 'en-US';
|
const fixedLocale = 'en-US';
|
||||||
const user = await min.userProfile.get(step.context, {});
|
const user = await min.userProfile.get(step.context, {});
|
||||||
|
let rate = 1;
|
||||||
|
|
||||||
|
if (process.env.PRIVACY_STORE_MESSAGES === 'true') {
|
||||||
// Updates values to perform Bot Analytics.
|
// Updates values to perform Bot Analytics.
|
||||||
|
|
||||||
const analytics = new AnalyticsService();
|
const analytics = new AnalyticsService();
|
||||||
const rate = await analytics.updateConversationSuggestion(
|
let rate = await analytics.updateConversationSuggestion(
|
||||||
min.instance.instanceId,
|
min.instance.instanceId,
|
||||||
user.conversation.conversationId,
|
user.conversation.conversationId,
|
||||||
step.result,
|
step.result,
|
||||||
user.locale
|
user.locale
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (rate > 0.5) {
|
if (rate > 0.5) {
|
||||||
await min.conversationalService.sendText(min, step, Messages[fixedLocale].glad_you_liked);
|
await min.conversationalService.sendText(min, step, Messages[fixedLocale].glad_you_liked);
|
||||||
|
|
|
@ -39,7 +39,6 @@ import { GBMinInstance, IGBDialog } from 'botlib';
|
||||||
import { BotAdapter } from 'botbuilder';
|
import { BotAdapter } from 'botbuilder';
|
||||||
import { WaterfallDialog } from 'botbuilder-dialogs';
|
import { WaterfallDialog } from 'botbuilder-dialogs';
|
||||||
import { AnalyticsService } from '../../analytics.gblib/services/AnalyticsService.js';
|
import { AnalyticsService } from '../../analytics.gblib/services/AnalyticsService.js';
|
||||||
import { GBConversationalService } from '../../core.gbapp/services/GBConversationalService.js';
|
|
||||||
import { CSService } from '../services/CSService.js';
|
import { CSService } from '../services/CSService.js';
|
||||||
import { Messages } from '../strings.js';
|
import { Messages } from '../strings.js';
|
||||||
|
|
||||||
|
@ -89,7 +88,7 @@ export class QualityDialog extends IGBDialog {
|
||||||
await service.insertQuestionAlternate(min.instance.instanceId, user.lastQuestion, user.lastQuestionId);
|
await service.insertQuestionAlternate(min.instance.instanceId, user.lastQuestion, user.lastQuestionId);
|
||||||
|
|
||||||
// Updates values to perform Bot Analytics.
|
// Updates values to perform Bot Analytics.
|
||||||
|
if (process.env.PRIVACY_STORE_MESSAGES === 'true') {
|
||||||
const analytics = new AnalyticsService();
|
const analytics = new AnalyticsService();
|
||||||
analytics.updateConversationSuggestion(
|
analytics.updateConversationSuggestion(
|
||||||
min.instance.instanceId,
|
min.instance.instanceId,
|
||||||
|
@ -97,7 +96,7 @@ export class QualityDialog extends IGBDialog {
|
||||||
step.result,
|
step.result,
|
||||||
user.locale
|
user.locale
|
||||||
);
|
);
|
||||||
|
}
|
||||||
// Goes to the ask loop.
|
// Goes to the ask loop.
|
||||||
|
|
||||||
return await step.replaceDialog('/ask', { emptyPrompt: true });
|
return await step.replaceDialog('/ask', { emptyPrompt: true });
|
||||||
|
|
Loading…
Add table
Reference in a new issue