Merge branch 'master' of https://github.com/GeneralBots/BotServer
This commit is contained in:
commit
6d68d212bf
5 changed files with 1576 additions and 1575 deletions
|
@ -255,7 +255,8 @@ export class GBConversationalService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async sendEvent(min: GBMinInstance, step: GBDialogStep, name: string, value: Object): Promise<any> {
|
public async sendEvent(min: GBMinInstance, step: GBDialogStep, name: string, value: Object): Promise<any> {
|
||||||
if (!this.userMobile(step)) {
|
if (!this.userMobile(step) &&
|
||||||
|
step.context.activity.channelId !== 'msteams') {
|
||||||
GBLog.info(`Sending event ${name}:${typeof value === 'object' ? JSON.stringify(value) :
|
GBLog.info(`Sending event ${name}:${typeof value === 'object' ? JSON.stringify(value) :
|
||||||
value ? value : ''} to client...`);
|
value ? value : ''} to client...`);
|
||||||
const msg = MessageFactory.text('');
|
const msg = MessageFactory.text('');
|
||||||
|
|
|
@ -34,27 +34,27 @@
|
||||||
* @fileoverview General Bots server core.
|
* @fileoverview General Bots server core.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
const { DialogSet, TextPrompt } = require('botbuilder-dialogs');
|
const { DialogSet, TextPrompt } = require('botbuilder-dialogs');
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const Fs = require('fs');
|
const Fs = require('fs');
|
||||||
const request = require('request-promise-native');
|
const request = require('request-promise-native');
|
||||||
const removeRoute = require('express-remove-route');
|
const removeRoute = require('express-remove-route');
|
||||||
const ssrForBots = require("ssr-for-bots").default;
|
const ssrForBots = require("ssr-for-bots").default;
|
||||||
const AuthenticationContext = require('adal-node').AuthenticationContext;
|
const AuthenticationContext = require('adal-node').AuthenticationContext;
|
||||||
const wash = require('washyourmouthoutwithsoap');
|
const wash = require('washyourmouthoutwithsoap');
|
||||||
const { FacebookAdapter } = require('botbuilder-adapter-facebook');
|
const { FacebookAdapter } = require('botbuilder-adapter-facebook');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
import {
|
import {
|
||||||
AutoSaveStateMiddleware,
|
AutoSaveStateMiddleware,
|
||||||
BotFrameworkAdapter,
|
BotFrameworkAdapter,
|
||||||
ConversationState,
|
ConversationState,
|
||||||
MemoryStorage,
|
MemoryStorage,
|
||||||
TurnContext,
|
TurnContext,
|
||||||
UserState
|
UserState
|
||||||
} from 'botbuilder';
|
} from 'botbuilder';
|
||||||
import { ConfirmPrompt, OAuthPrompt, WaterfallDialog } from 'botbuilder-dialogs';
|
import { ConfirmPrompt, OAuthPrompt, WaterfallDialog } from 'botbuilder-dialogs';
|
||||||
import {
|
import {
|
||||||
GBDialogStep,
|
GBDialogStep,
|
||||||
GBLog,
|
GBLog,
|
||||||
GBMinInstance,
|
GBMinInstance,
|
||||||
|
@ -63,32 +63,32 @@
|
||||||
IGBCoreService,
|
IGBCoreService,
|
||||||
IGBInstance,
|
IGBInstance,
|
||||||
IGBPackage
|
IGBPackage
|
||||||
} from 'botlib';
|
} from 'botlib';
|
||||||
import { CollectionUtil } from 'pragmatismo-io-framework';
|
import { CollectionUtil } from 'pragmatismo-io-framework';
|
||||||
import { MicrosoftAppCredentials } from 'botframework-connector';
|
import { MicrosoftAppCredentials } from 'botframework-connector';
|
||||||
import { GBServer } from '../../../src/app';
|
import { GBServer } from '../../../src/app';
|
||||||
import { GBAdminService } from '../../admin.gbapp/services/GBAdminService';
|
import { GBAdminService } from '../../admin.gbapp/services/GBAdminService';
|
||||||
import { GuaribasConversationMessage } from '../../analytics.gblib/models';
|
import { GuaribasConversationMessage } from '../../analytics.gblib/models';
|
||||||
import { AnalyticsService } from '../../analytics.gblib/services/AnalyticsService';
|
import { AnalyticsService } from '../../analytics.gblib/services/AnalyticsService';
|
||||||
import { GBVMService } from '../../basic.gblib/services/GBVMService';
|
import { GBVMService } from '../../basic.gblib/services/GBVMService';
|
||||||
import { AskDialogArgs } from '../../kb.gbapp/dialogs/AskDialog';
|
import { AskDialogArgs } from '../../kb.gbapp/dialogs/AskDialog';
|
||||||
import { KBService } from '../../kb.gbapp/services/KBService';
|
import { KBService } from '../../kb.gbapp/services/KBService';
|
||||||
import { SecService } from '../../security.gbapp/services/SecService';
|
import { SecService } from '../../security.gbapp/services/SecService';
|
||||||
import { WhatsappDirectLine } from '../../whatsapp.gblib/services/WhatsappDirectLine';
|
import { WhatsappDirectLine } from '../../whatsapp.gblib/services/WhatsappDirectLine';
|
||||||
import { Messages } from '../strings';
|
import { Messages } from '../strings';
|
||||||
import { GBConfigService } from './GBConfigService';
|
import { GBConfigService } from './GBConfigService';
|
||||||
import { GBConversationalService } from './GBConversationalService';
|
import { GBConversationalService } from './GBConversationalService';
|
||||||
import { GBDeployer } from './GBDeployer';
|
import { GBDeployer } from './GBDeployer';
|
||||||
import urlJoin = require('url-join');
|
import urlJoin = require('url-join');
|
||||||
import fs = require('fs');
|
import fs = require('fs');
|
||||||
import { GoogleChatDirectLine } from '../../google-chat.gblib/services/GoogleChatDirectLine';
|
import { GoogleChatDirectLine } from '../../google-chat.gblib/services/GoogleChatDirectLine';
|
||||||
import { ScheduleServices } from '../../basic.gblib/services/ScheduleServices';
|
import { ScheduleServices } from '../../basic.gblib/services/ScheduleServices';
|
||||||
import { SystemKeywords } from '../../basic.gblib/services/SystemKeywords';
|
import { SystemKeywords } from '../../basic.gblib/services/SystemKeywords';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minimal service layer for a bot and encapsulation of BOT Framework calls.
|
* Minimal service layer for a bot and encapsulation of BOT Framework calls.
|
||||||
*/
|
*/
|
||||||
export class GBMinService {
|
export class GBMinService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default General Bots User Interface package.
|
* Default General Bots User Interface package.
|
||||||
|
@ -1350,7 +1350,7 @@
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
const startDialog = user.hearOnDialog ?
|
const startDialog = user.hearOnDialog ?
|
||||||
user.hecallbackarOnDialog :
|
user.hearOnDialog :
|
||||||
min.core.getParam(min.instance, 'Start Dialog', null);
|
min.core.getParam(min.instance, 'Start Dialog', null);
|
||||||
|
|
||||||
if (text !== startDialog) {
|
if (text !== startDialog) {
|
||||||
|
@ -1381,5 +1381,4 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,21 +34,21 @@
|
||||||
* @fileoverview General Bots server core.
|
* @fileoverview General Bots server core.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { BotAdapter } from 'botbuilder';
|
import { BotAdapter } from 'botbuilder';
|
||||||
import { WaterfallDialog } from 'botbuilder-dialogs';
|
import { WaterfallDialog } from 'botbuilder-dialogs';
|
||||||
import { GBMinInstance, IGBDialog } from 'botlib';
|
import { GBMinInstance, IGBDialog } from 'botlib';
|
||||||
import { GBMinService } from '../../core.gbapp/services/GBMinService';
|
import { GBMinService } from '../../core.gbapp/services/GBMinService';
|
||||||
import { AnalyticsService } from '../../analytics.gblib/services/AnalyticsService';
|
import { AnalyticsService } from '../../analytics.gblib/services/AnalyticsService';
|
||||||
import { SecService } from '../../security.gbapp/services/SecService';
|
import { SecService } from '../../security.gbapp/services/SecService';
|
||||||
import { CSService } from '../services/CSService';
|
import { CSService } from '../services/CSService';
|
||||||
import { Messages } from '../strings';
|
import { Messages } from '../strings';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dialog for feedback collecting.
|
* Dialog for feedback collecting.
|
||||||
*/
|
*/
|
||||||
export class FeedbackDialog extends IGBDialog {
|
export class FeedbackDialog extends IGBDialog {
|
||||||
/**
|
/**
|
||||||
* Setup dialogs flows and define services call.
|
* Setup dialogs flows and define services call.
|
||||||
*
|
*
|
||||||
|
@ -257,4 +257,5 @@ export class FeedbackDialog extends IGBDialog {
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,9 +188,9 @@ export class AskDialog extends IGBDialog {
|
||||||
const locale = step.context.activity.locale;
|
const locale = step.context.activity.locale;
|
||||||
|
|
||||||
// Stops any content on projector.
|
// Stops any content on projector.
|
||||||
|
if (step.context.activity.channelId !== 'msteams') {
|
||||||
await min.conversationalService.sendEvent(min, step, 'stop', undefined);
|
await min.conversationalService.sendEvent(min, step, 'stop', undefined);
|
||||||
|
}
|
||||||
// Handle extra text from FAQ.
|
// Handle extra text from FAQ.
|
||||||
|
|
||||||
if (step.options && step.options.query) {
|
if (step.options && step.options.query) {
|
||||||
|
|
|
@ -182,9 +182,9 @@ export class SecService extends GBService {
|
||||||
|
|
||||||
await CollectionUtil.asyncForEach(list, async item => {
|
await CollectionUtil.asyncForEach(list, async item => {
|
||||||
if (
|
if (
|
||||||
!(item !== undefined &&
|
item !== undefined &&
|
||||||
agentSystemId === undefined &&
|
agentSystemId === undefined &&
|
||||||
item !== userSystemId && await this.isAgentSystemId(item))
|
item !== userSystemId && !await this.isAgentSystemId(item)
|
||||||
) {
|
) {
|
||||||
// TODO: Optimize loop.
|
// TODO: Optimize loop.
|
||||||
agentSystemId = item;
|
agentSystemId = item;
|
||||||
|
|
Loading…
Add table
Reference in a new issue