From 98ef0213ac8ad4077c55f16a34141007612ae1bb Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Wed, 11 Sep 2024 00:33:17 -0300 Subject: [PATCH] new (basic.gblib): auto-publish. --- packages/core.gbapp/services/GBDeployer.ts | 2 +- packages/core.gbapp/services/GBMinService.ts | 8 ++++---- packages/kb.gbapp/services/KBService.ts | 4 ++-- .../default.gbdialog/create-event-sheet.bas.map | 1 + .../default.gbdialog/describe-image-tool.bas.map | 1 + .../default.gbai/default.gbdialog/generate-image-tool.bas | 1 + 6 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 templates/default.gbai/default.gbdialog/create-event-sheet.bas.map create mode 100644 templates/default.gbai/default.gbdialog/describe-image-tool.bas.map diff --git a/packages/core.gbapp/services/GBDeployer.ts b/packages/core.gbapp/services/GBDeployer.ts index 3cb045dc..e3ac9706 100644 --- a/packages/core.gbapp/services/GBDeployer.ts +++ b/packages/core.gbapp/services/GBDeployer.ts @@ -606,7 +606,7 @@ export class GBDeployer implements IGBDeployer { } if (!GBConfigService.get('STORAGE_NAME')) { - const filePath = path.join(GBConfigService.get('STORAGE_LIBRARY'), gbai); + const filePath = path.join(GBConfigService.get('STORAGE_LIBRARY'), gbai, packageName); GBUtil.copyIfNewerRecursive(filePath, packageWorkFolder); } else { await this.downloadFolder(min, path.join('work', `${gbai}`), packageName); diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index e64d4761..803d1528 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -1749,9 +1749,9 @@ await fs.writeFile(localFileName, buffer); private async watchPackages(min: GBMinInstance, packageType) { if (!GBConfigService.get('STORAGE_NAME')) { const packagePath = GBUtil.getGBAIPath(min.botId, packageType); - const dirPath = path.join(GBConfigService.get('STORAGE_LIBRARY'), packagePath); + const libraryPath = path.join(GBConfigService.get('STORAGE_LIBRARY'), packagePath); - const watcher = chokidar.watch(dirPath, { + const watcher = chokidar.watch(libraryPath, { persistent: true, ignoreInitial: true, // Ignore initial add events depth: 99, // Watch subdirectories @@ -1780,8 +1780,8 @@ await fs.writeFile(localFileName, buffer); if (this.recentChanges.size > 0) { try { - - await this.deployer.deployPackage2(min, null, dirPath); + const workFolder = path.join('work', packagePath); + await this.deployer.deployPackage2(min, null, workFolder, true); } catch (error) { GBLogEx.error(min, `Error deploying package: ${GBUtil.toYAML(error)}`); diff --git a/packages/kb.gbapp/services/KBService.ts b/packages/kb.gbapp/services/KBService.ts index e144fc0c..329d79cc 100644 --- a/packages/kb.gbapp/services/KBService.ts +++ b/packages/kb.gbapp/services/KBService.ts @@ -471,7 +471,7 @@ export class KBService implements IGBKBService { const answers = []; const questions = []; - GBLogEx.info(min, `Processing ${rows.length} rows from tabular file ${filePath}...`); + GBLogEx.info(min, `Processing ${rows.length} rows from ${path.basename(filePath)}...`); await asyncPromise.eachSeries(rows, async line => { // Skips the first line. @@ -1370,7 +1370,7 @@ export class KBService implements IGBKBService { await fs.writeFile(packagePath, html, 'utf8'); } - GBLogEx.info(min, `Done publishing of: ${localPath}.`); + GBLogEx.info(min, `Done publishing of: ${path.basename(localPath)}.`); } private async playAudio( diff --git a/templates/default.gbai/default.gbdialog/create-event-sheet.bas.map b/templates/default.gbai/default.gbdialog/create-event-sheet.bas.map new file mode 100644 index 00000000..c3892e48 --- /dev/null +++ b/templates/default.gbai/default.gbdialog/create-event-sheet.bas.map @@ -0,0 +1 @@ +{"2":42,"3":43,"4":44,"5":45,"6":46,"7":47,"8":48,"9":49,"10":50,"11":51,"12":52,"13":53,"14":54,"15":55,"16":56,"17":57,"18":58,"19":59,"20":60,"21":61,"22":62,"23":63,"24":64} \ No newline at end of file diff --git a/templates/default.gbai/default.gbdialog/describe-image-tool.bas.map b/templates/default.gbai/default.gbdialog/describe-image-tool.bas.map new file mode 100644 index 00000000..5b742027 --- /dev/null +++ b/templates/default.gbai/default.gbdialog/describe-image-tool.bas.map @@ -0,0 +1 @@ +{"2":42,"3":43,"4":44} \ No newline at end of file diff --git a/templates/default.gbai/default.gbdialog/generate-image-tool.bas b/templates/default.gbai/default.gbdialog/generate-image-tool.bas index 4ccd2737..12ea69f5 100644 --- a/templates/default.gbai/default.gbdialog/generate-image-tool.bas +++ b/templates/default.gbai/default.gbdialog/generate-image-tool.bas @@ -2,3 +2,4 @@ PARAM prompt as STRING LIKE "Generate a cat." DESCRIPTION Calls an artificial intelligence model to create an image. `prompt` parameter is a text description of the desired image. FIND RETURN "https://" + \ No newline at end of file