Merge branch 'main' of https://github.com/GeneralBots/BotServer
This commit is contained in:
commit
2d4b735724
6 changed files with 38 additions and 15 deletions
|
@ -1,3 +1,10 @@
|
|||
## [2.4.15](https://github.com/GeneralBots/BotServer/compare/2.4.14...2.4.15) (2023-07-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **all:** Create bot working again. ([4eecd5a](https://github.com/GeneralBots/BotServer/commit/4eecd5acec56547e5b5ab064f52dc81eb451e1a4))
|
||||
|
||||
## [2.4.14](https://github.com/GeneralBots/BotServer/compare/2.4.13...2.4.14) (2023-07-18)
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "botserver",
|
||||
"version": "2.4.14",
|
||||
"version": "2.4.15",
|
||||
"type": "module",
|
||||
"description": "General Bot Community Edition open-core server.",
|
||||
"main": "./boot.mjs",
|
||||
|
|
|
@ -224,9 +224,12 @@ export class GBAdminService implements IGBAdminService {
|
|||
return obj.value;
|
||||
}
|
||||
|
||||
public async acquireElevatedToken(instanceId: number): Promise<string> {
|
||||
const minBoot = GBServer.globals.minBoot;
|
||||
instanceId = minBoot.instance.instanceId;
|
||||
public async acquireElevatedToken(instanceId: number, root: boolean = false): Promise<string> {
|
||||
|
||||
if (root){
|
||||
const minBoot = GBServer.globals.minBoot;
|
||||
instanceId = minBoot.instance.instanceId;
|
||||
}
|
||||
let expiresOnV;
|
||||
try {
|
||||
expiresOnV = await this.getValue(instanceId, 'expiresOn');
|
||||
|
|
|
@ -104,7 +104,7 @@ export class GBDeployer implements IGBDeployer {
|
|||
* Retrives token and initialize drive client API.
|
||||
*/
|
||||
public static async internalGetDriveClient(min: GBMinInstance) {
|
||||
const token = await min.adminService.acquireElevatedToken(min.instance.instanceId);
|
||||
const token = await min.adminService['acquireElevatedToken'](min.instance.instanceId, true);
|
||||
const siteId = process.env.STORAGE_SITE_ID;
|
||||
const libraryId = process.env.STORAGE_LIBRARY;
|
||||
|
||||
|
@ -209,7 +209,7 @@ export class GBDeployer implements IGBDeployer {
|
|||
|
||||
// Gets the access token to perform service operations.
|
||||
|
||||
const accessToken = await GBServer.globals.minBoot.adminService.acquireElevatedToken(bootInstance.instanceId);
|
||||
const accessToken = await min.adminService['acquireElevatedToken'](min.instance.instanceId, true);
|
||||
|
||||
// Creates the MSFT application that will be associated to the bot.
|
||||
|
||||
|
@ -401,7 +401,7 @@ export class GBDeployer implements IGBDeployer {
|
|||
|
||||
// Connects to MSFT storage.
|
||||
|
||||
const token = await min.adminService.acquireElevatedToken(min.instance.instanceId);
|
||||
const token = await min.adminService['acquireElevatedToken'](min.instance.instanceId, true);
|
||||
const client = MicrosoftGraph.Client.init({
|
||||
authProvider: done => {
|
||||
done(null, token);
|
||||
|
|
|
@ -707,7 +707,7 @@ export class GBMinService {
|
|||
min['scheduleMap'] = {};
|
||||
min['conversationWelcomed'] = {};
|
||||
min.packages = sysPackages;
|
||||
|
||||
|
||||
// NLP Manager.
|
||||
|
||||
const manager = new NlpManager({ languages: ['pt'], forceNER: true });
|
||||
|
@ -725,7 +725,7 @@ export class GBMinService {
|
|||
});
|
||||
}
|
||||
|
||||
min.appPackages = await this.core['getApplicationsByInstanceId'] (appPackages, min.instance.instanceId);
|
||||
min.appPackages = await this.core['getApplicationsByInstanceId'](appPackages, min.instance.instanceId);
|
||||
|
||||
// Creates a hub of services available in .gbapps.
|
||||
|
||||
|
@ -1050,8 +1050,7 @@ export class GBMinService {
|
|||
await this.processEventActivity(min, user, context, step);
|
||||
}
|
||||
} catch (error) {
|
||||
const msg = `ERROR: ${error.message} ${error.stack} ${error.error ? error.error.body : ''} ${error.error ? (error.error.stack ? error.error.stack : '') : ''
|
||||
}`;
|
||||
const msg = `ERROR: ${error.message} ${error.stack} ${error.error ? error.error.body : ''} ${error.error ? (error.error.stack ? error.error.stack : '') : '' }`;
|
||||
GBLog.error(msg);
|
||||
|
||||
await min.conversationalService.sendText(
|
||||
|
@ -1065,7 +1064,7 @@ export class GBMinService {
|
|||
};
|
||||
|
||||
try {
|
||||
|
||||
|
||||
await adapter['processActivity'](req, res, handler);
|
||||
} catch (error) {
|
||||
if (error.code === 401) {
|
||||
|
@ -1270,7 +1269,7 @@ export class GBMinService {
|
|||
accum.push(result);
|
||||
return accum;
|
||||
}, []) as GBFile[];
|
||||
|
||||
|
||||
if (min.cbMap[userId] && min.cbMap[userId].promise == '!GBHEAR') {
|
||||
if (results.length > 1) {
|
||||
throw new Error('It is only possible to upload one file per message, right now.');
|
||||
|
@ -1477,7 +1476,21 @@ export class GBMinService {
|
|||
|
||||
// If there is a dialog in course, continue to the next step.
|
||||
else if (step.activeDialog !== undefined) {
|
||||
await step.continueDialog();
|
||||
|
||||
try {
|
||||
await step.continueDialog();
|
||||
|
||||
} catch (error) {
|
||||
const msg = `ERROR: ${error.message} ${error.stack} ${error.error ? error.error.body : ''} ${error.error ? (error.error.stack ? error.error.stack : '') : '' }`;
|
||||
GBLog.error(msg);
|
||||
await min.conversationalService.sendText(
|
||||
min,
|
||||
step,
|
||||
Messages[step.context.activity.locale].very_sorry_about_error
|
||||
);
|
||||
await step.beginDialog('/ask', { isReturning: true });
|
||||
}
|
||||
|
||||
} else {
|
||||
const startDialog = user.hearOnDialog
|
||||
? user.hearOnDialog
|
||||
|
|
|
@ -179,7 +179,7 @@ export class SecService extends GBService {
|
|||
await CollectionUtil.asyncForEach(list, async item => {
|
||||
if (
|
||||
item !== undefined &&
|
||||
agentSystemId === undefined &&
|
||||
!agentSystemId &&
|
||||
item !== userSystemId &&
|
||||
!(await this.isAgentSystemId(item))
|
||||
) {
|
||||
|
|
Loading…
Add table
Reference in a new issue