BREAKING CHANGE: General Bots is now 3.0.
This commit is contained in:
parent
d6a4d6282e
commit
661a9c0350
6 changed files with 52 additions and 79 deletions
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "botserver",
|
"name": "botserver",
|
||||||
"version": "2.4.18",
|
"version": "3.0.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"description": "General Bot Community Edition open-core server.",
|
"description": "General Bot Community Edition open-core server.",
|
||||||
"main": "./boot.mjs",
|
"main": "./boot.mjs",
|
||||||
|
|
|
@ -937,7 +937,8 @@ export class GBDeployer implements IGBDeployer {
|
||||||
'kb.gbapp',
|
'kb.gbapp',
|
||||||
'google-chat.gblib',
|
'google-chat.gblib',
|
||||||
'teams.gblib',
|
'teams.gblib',
|
||||||
'hubspot.gblib'
|
'hubspot.gblib',
|
||||||
|
'gpt.gblib'
|
||||||
];
|
];
|
||||||
|
|
||||||
return names.indexOf(name) > -1;
|
return names.indexOf(name) > -1;
|
||||||
|
|
|
@ -49,9 +49,9 @@ export class GBGPTPackage implements IGBPackage {
|
||||||
public CurrentEngineName = 'guaribas-1.0.0';
|
public CurrentEngineName = 'guaribas-1.0.0';
|
||||||
|
|
||||||
public async loadPackage(core: IGBCoreService, sequelize: Sequelize): Promise<void> {
|
public async loadPackage(core: IGBCoreService, sequelize: Sequelize): Promise<void> {
|
||||||
core.sequelize.addModels([GuaribasSchedule]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getDialogs(min: GBMinInstance) {
|
public async getDialogs(min: GBMinInstance) {
|
||||||
GBLog.verbose(`getDialogs called.`);
|
GBLog.verbose(`getDialogs called.`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
import { GBSSR }from '../../core.gbapp/services/GBSSR.js';
|
import { GBSSR }from '../../core.gbapp/services/GBSSR.js';
|
||||||
|
|
||||||
export class ChartServices {
|
export class ChatServices {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate text
|
* Generate text
|
||||||
|
|
42
packages/gpt.gblib/services/CodeServices.ts
Normal file
42
packages/gpt.gblib/services/CodeServices.ts
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
/*****************************************************************************\
|
||||||
|
| ( )_ _ |
|
||||||
|
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
|
||||||
|
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' v `\ /'_`\ |
|
||||||
|
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
|
||||||
|
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
|
||||||
|
| | | ( )_) | |
|
||||||
|
| (_) \___/' |
|
||||||
|
| |
|
||||||
|
| General Bots Copyright (c) Pragmatismo.io. All rights reserved. |
|
||||||
|
| Licensed under the AGPL-3.0. |
|
||||||
|
| |
|
||||||
|
| According to our dual licensing model, this program can be used either |
|
||||||
|
| under the terms of the GNU Affero General Public License, version 3, |
|
||||||
|
| or under a proprietary license. |
|
||||||
|
| |
|
||||||
|
| The texts of the GNU Affero General Public License with an additional |
|
||||||
|
| permission and of our proprietary license can be found at and |
|
||||||
|
| in the LICENSE file you have received along with this program. |
|
||||||
|
| |
|
||||||
|
| This program is distributed in the hope that it will be useful, |
|
||||||
|
| but WITHOUT ANY WARRANTY, without even the implied warranty of |
|
||||||
|
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||||
|
| GNU Affero General Public License for more details. |
|
||||||
|
| |
|
||||||
|
| "General Bots" is a registered trademark of Pragmatismo.io. |
|
||||||
|
| The licensing of the program under the AGPLv3 does not imply a |
|
||||||
|
| trademark license. Therefore any rights, title and interest in |
|
||||||
|
| our trademarks remain entirely with us. |
|
||||||
|
| |
|
||||||
|
\*****************************************************************************/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
import { GBSSR }from '../../core.gbapp/services/GBSSR.js';
|
||||||
|
|
||||||
|
export class CodeServices {
|
||||||
|
|
||||||
|
public static async refactor (code, whatToDo) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -34,7 +34,6 @@
|
||||||
|
|
||||||
import Path from 'path';
|
import Path from 'path';
|
||||||
import { GBLog, GBMinInstance } from 'botlib';
|
import { GBLog, GBMinInstance } from 'botlib';
|
||||||
import { DialogKeywords } from './DialogKeywords.js';
|
|
||||||
import sharp from 'sharp';
|
import sharp from 'sharp';
|
||||||
import joinImages from 'join-images-updated';
|
import joinImages from 'join-images-updated';
|
||||||
import { CollectionUtil } from 'pragmatismo-io-framework';
|
import { CollectionUtil } from 'pragmatismo-io-framework';
|
||||||
|
@ -45,79 +44,10 @@ import { GBServer } from '../../../src/app.js';
|
||||||
/**
|
/**
|
||||||
* Image processing services of conversation to be called by BASIC.
|
* Image processing services of conversation to be called by BASIC.
|
||||||
*/
|
*/
|
||||||
export class ImageProcessingServices {
|
export class ImageServices {
|
||||||
/**
|
|
||||||
* Sharpen the image.
|
|
||||||
*
|
|
||||||
* @example file = SHARPEN file
|
|
||||||
*/
|
|
||||||
public async sharpen({ pid, file: file }) {
|
|
||||||
GBLog.info(`BASIC: Image Processing SHARPEN ${file}.`);
|
|
||||||
|
|
||||||
const gbfile = DialogKeywords.getFileByHandle(file);
|
public async getImageFromDescription(text: string): Promise<string> {
|
||||||
const data = await sharp(gbfile.data)
|
const url = "https://";
|
||||||
.sharpen({
|
return url;
|
||||||
sigma: 2,
|
|
||||||
m1: 0,
|
|
||||||
m2: 3,
|
|
||||||
x1: 3,
|
|
||||||
y2: 15,
|
|
||||||
y3: 15
|
|
||||||
})
|
|
||||||
.toBuffer();
|
|
||||||
|
|
||||||
const newFile = {
|
|
||||||
filename: gbfile.filename,
|
|
||||||
data: data
|
|
||||||
|
|
||||||
};
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* SET ORIENTATION VERTICAL
|
|
||||||
*
|
|
||||||
* file = MERGE file1, file2, file3
|
|
||||||
*/
|
|
||||||
public async mergeImage({pid, files})
|
|
||||||
{
|
|
||||||
const { min, user } = await DialogKeywords.getProcessInfo(pid);
|
|
||||||
|
|
||||||
let paths = [];
|
|
||||||
await CollectionUtil.asyncForEach(files, async file => {
|
|
||||||
const gbfile = DialogKeywords.getFileByHandle(file);
|
|
||||||
paths.push(gbfile.path);
|
|
||||||
});
|
|
||||||
|
|
||||||
const botId = min.instance.botId;
|
|
||||||
const path = DialogKeywords.getGBAIPath(min.botId);
|
|
||||||
const img = await joinImages(paths);
|
|
||||||
const localName = Path.join('work', path, 'cache', `img-mrg${GBAdminService.getRndReadableIdentifier()}.png`);
|
|
||||||
const url = urlJoin(GBServer.globals.publicAddress, min.botId, 'cache', Path.basename(localName));
|
|
||||||
img.toFile(localName);
|
|
||||||
|
|
||||||
return { localName: localName, url: url, data: null };
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sharpen the image.
|
|
||||||
*
|
|
||||||
* @example file = BLUR file
|
|
||||||
*/
|
|
||||||
public async blur({ pid, file: file }) {
|
|
||||||
GBLog.info(`BASIC: Image Processing SHARPEN ${file}.`);
|
|
||||||
|
|
||||||
const gbfile = DialogKeywords.getFileByHandle(file);
|
|
||||||
const data = await sharp(gbfile.data)
|
|
||||||
.blur()
|
|
||||||
.toBuffer();
|
|
||||||
|
|
||||||
const newFile = {
|
|
||||||
filename: gbfile.filename,
|
|
||||||
data: data
|
|
||||||
};
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue