From 661a9c035023a8375a9b46cd06d9bd814d25f33f Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Sun, 23 Jul 2023 15:39:05 -0300 Subject: [PATCH] BREAKING CHANGE: General Bots is now 3.0. --- package.json | 2 +- packages/core.gbapp/services/GBDeployer.ts | 3 +- packages/gpt.gblib/index.ts | 4 +- packages/gpt.gblib/services/ChatServices.ts | 2 +- packages/gpt.gblib/services/CodeServices.ts | 42 +++++++++++ packages/gpt.gblib/services/ImageServices.ts | 78 +------------------- 6 files changed, 52 insertions(+), 79 deletions(-) create mode 100644 packages/gpt.gblib/services/CodeServices.ts diff --git a/package.json b/package.json index 22a9065b..dcc69c65 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "botserver", - "version": "2.4.18", + "version": "3.0.0", "type": "module", "description": "General Bot Community Edition open-core server.", "main": "./boot.mjs", diff --git a/packages/core.gbapp/services/GBDeployer.ts b/packages/core.gbapp/services/GBDeployer.ts index e7807151..d11e81d7 100644 --- a/packages/core.gbapp/services/GBDeployer.ts +++ b/packages/core.gbapp/services/GBDeployer.ts @@ -937,7 +937,8 @@ export class GBDeployer implements IGBDeployer { 'kb.gbapp', 'google-chat.gblib', 'teams.gblib', - 'hubspot.gblib' + 'hubspot.gblib', + 'gpt.gblib' ]; return names.indexOf(name) > -1; diff --git a/packages/gpt.gblib/index.ts b/packages/gpt.gblib/index.ts index eb413412..be295c0d 100644 --- a/packages/gpt.gblib/index.ts +++ b/packages/gpt.gblib/index.ts @@ -49,9 +49,9 @@ export class GBGPTPackage implements IGBPackage { public CurrentEngineName = 'guaribas-1.0.0'; public async loadPackage(core: IGBCoreService, sequelize: Sequelize): Promise { - core.sequelize.addModels([GuaribasSchedule]); + } - + public async getDialogs(min: GBMinInstance) { GBLog.verbose(`getDialogs called.`); } diff --git a/packages/gpt.gblib/services/ChatServices.ts b/packages/gpt.gblib/services/ChatServices.ts index 89b37f43..2711dbd6 100644 --- a/packages/gpt.gblib/services/ChatServices.ts +++ b/packages/gpt.gblib/services/ChatServices.ts @@ -34,7 +34,7 @@ import { GBSSR }from '../../core.gbapp/services/GBSSR.js'; -export class ChartServices { +export class ChatServices { /** * Generate text diff --git a/packages/gpt.gblib/services/CodeServices.ts b/packages/gpt.gblib/services/CodeServices.ts new file mode 100644 index 00000000..32b4a02e --- /dev/null +++ b/packages/gpt.gblib/services/CodeServices.ts @@ -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) { + } + + } diff --git a/packages/gpt.gblib/services/ImageServices.ts b/packages/gpt.gblib/services/ImageServices.ts index 22fe1be7..e7fb5417 100644 --- a/packages/gpt.gblib/services/ImageServices.ts +++ b/packages/gpt.gblib/services/ImageServices.ts @@ -34,7 +34,6 @@ import Path from 'path'; import { GBLog, GBMinInstance } from 'botlib'; -import { DialogKeywords } from './DialogKeywords.js'; import sharp from 'sharp'; import joinImages from 'join-images-updated'; 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. */ -export class ImageProcessingServices { - /** - * Sharpen the image. - * - * @example file = SHARPEN file - */ - public async sharpen({ pid, file: file }) { - GBLog.info(`BASIC: Image Processing SHARPEN ${file}.`); +export class ImageServices { - const gbfile = DialogKeywords.getFileByHandle(file); - const data = await sharp(gbfile.data) - .sharpen({ - sigma: 2, - m1: 0, - m2: 3, - x1: 3, - y2: 15, - y3: 15 - }) - .toBuffer(); - - const newFile = { - filename: gbfile.filename, - data: data - - }; - return; + public async getImageFromDescription(text: string): Promise { + const url = "https://"; + return url; } - - /** - * 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; - } - }