new(customer-satisfaction): New behaviour while liking content.

This commit is contained in:
Rodrigo Rodriguez 2021-04-02 14:50:39 -03:00
parent 3ef4d69c47
commit ba7f54cac0
4 changed files with 22 additions and 19 deletions

View file

@ -38,7 +38,6 @@ import { GBAdminService } from '../../admin.gbapp/services/GBAdminService';
import { GBDeployer } from '../../core.gbapp/services/GBDeployer';
import { SecService } from '../../security.gbapp/services/SecService';
const request = require('request-promise-native');
const MicrosoftGraph = require('@microsoft/microsoft-graph-client');
const path = require('path');
const sgMail = require('@sendgrid/mail');

View file

@ -66,7 +66,7 @@ const { IamAuthenticator } = require('ibm-watson/auth');
* services like NLP or Search.
*/
export class GBConversationalService {
/**
* Reference to the core service.
*/
@ -769,7 +769,7 @@ export class GBConversationalService {
const user = await min.userProfile.get(step.context, {});
const systemUser = user.systemUser;
if (text !== null) {
if (text && text !== "") {
text = await min.conversationalService.translate(
min,
text,
@ -858,7 +858,7 @@ export class GBConversationalService {
}
});
}
/**
*
* Sends a message in a user with an already started conversation (got ConversationReference set)

View file

@ -59,22 +59,30 @@ export class QualityDialog extends IGBDialog {
const service = new CSService();
min.dialogs.add(new WaterfallDialog('/quality', [
async step => {
async step => {
const locale = step.context.activity.locale;
const user = await min.userProfile.get(step.context, {});
const score = step.result;
setTimeout(
() => min.conversationalService.sendEvent(min, step, 'stop', undefined),
400
);
if (score === 0) {
await min.conversationalService.sendText(min, step, Messages[locale].im_sorry_lets_try);
return await step.next();
} else {
await min.conversationalService.sendText(min, step, Messages[locale].great_thanks);
await min.conversationalService.sendEvent(min, step, 'play', {
playerType: 'markdown',
data: {
content: Messages[locale].great_thanks,
}
});
let sleep = ms => {
return new Promise(resolve => {
setTimeout(resolve, ms);
});
};
await service.insertQuestionAlternate(
min.instance.instanceId,
user.lastQuestion,
@ -89,10 +97,8 @@ export class QualityDialog extends IGBDialog {
// Goes to the ask loop.
await step.replaceDialog('/ask', { isReturning: true });
return await step.replaceDialog('/ask', { emptyPrompt: true });
}
return await step.next();
}
]));
}

View file

@ -100,11 +100,9 @@ export class AskDialog extends IGBDialog {
} else {
throw new Error('Invalid use of /ask');
}
if (text.length > 0) {
return await min.conversationalService.prompt(min, step, text);
}
return await step.next();
return await min.conversationalService.prompt(min, step, text);
},
async step => {
if (step.result) {