diff --git a/packages/admin.gbapp/services/GBAdminService.ts b/packages/admin.gbapp/services/GBAdminService.ts index 250d5080..926a542d 100644 --- a/packages/admin.gbapp/services/GBAdminService.ts +++ b/packages/admin.gbapp/services/GBAdminService.ts @@ -168,7 +168,7 @@ export class GBAdminService implements IGBAdminService { ) { const packageName = text.split(' ')[1]; - const folderName = text.split(' ')[2]; + const folderName = text.substring(text.indexOf(packageName) + packageName.length + 1); const packageType = path.extname(folderName).substr(1); const gbaiPath = GBUtil.getGBAIPath(min.instance.botId, packageType, null); const localFolder = path.join('work', gbaiPath); diff --git a/packages/basic.gblib/services/ImageProcessingServices.ts b/packages/basic.gblib/services/ImageProcessingServices.ts index d253a4ce..01024462 100644 --- a/packages/basic.gblib/services/ImageProcessingServices.ts +++ b/packages/basic.gblib/services/ImageProcessingServices.ts @@ -113,7 +113,7 @@ export class ImageProcessingServices { const azureOpenAIEndpoint = await min.core.getParam(min.instance, 'Azure Open AI Endpoint', null, true); const azureOpenAIVersion = await (min.core as any)['getParam'](min.instance, 'Azure Open AI Version', null, true); const azureOpenAIImageModel = await (min.core as any)['getParam'](min.instance, 'Azure Open AI Image Model', null, true); - + if (azureOpenAIKey) { // Initialize the Azure OpenAI client @@ -124,16 +124,17 @@ export class ImageProcessingServices { apiVersion: azureOpenAIVersion, apiKey: azureOpenAIKey }); - - // Make a request to the image generation endpoint - - const response = await client.images.generate({ - model: '', - prompt: prompt, - n: 1, - size: '1024x1024' - }); + // Make a request to the image generation endpoint + + const response = await client.images.generate({ + + prompt: prompt, + n: 1, // Don't include for DALL-E 3 (always generates 1 image) + style: 'vivid', // optional ('natural' or 'vivid') + size: '1024x1024', + quality: 'standard', // optional + }); const gbaiName = GBUtil.getGBAIPath(min.botId); const localName = path.join('work', gbaiName, 'cache', `DALL-E${GBAdminService.getRndReadableIdentifier()}.png`); diff --git a/packages/basic.gblib/services/KeywordsExpressions.ts b/packages/basic.gblib/services/KeywordsExpressions.ts index 40040326..107a07ee 100644 --- a/packages/basic.gblib/services/KeywordsExpressions.ts +++ b/packages/basic.gblib/services/KeywordsExpressions.ts @@ -906,6 +906,15 @@ export class KeywordsExpressions { } ]; + keywords[i++] = [ + /^\s*(POST TO INSTAGRAM)(\s*)(.*)/gim, + ($0, $1, $2, $3) => { + const params = this.getParams($3, ['username', 'password', 'imagePath', 'caption']); + return `await sys.postToInstagram ({pid: pid, ${params}})`; + } + ]; + + keywords[i++] = [ /^\s*((?:[a-z]+.?)(?:(?:\w+).)(?:\w+)*)\s*=\s*(datediff)(\s*)(.*)/gim, ($0, $1, $2, $3, $4) => { diff --git a/packages/basic.gblib/services/SystemKeywords.ts b/packages/basic.gblib/services/SystemKeywords.ts index 119e828f..1a713d23 100644 --- a/packages/basic.gblib/services/SystemKeywords.ts +++ b/packages/basic.gblib/services/SystemKeywords.ts @@ -2616,6 +2616,8 @@ export class SystemKeywords { return answer.answer; } + + /** * HEAR description * text = REWRITE description @@ -2623,9 +2625,9 @@ export class SystemKeywords { */ public async rewrite({ pid, text }) { const { min, user } = await DialogKeywords.getProcessInfo(pid); - const prompt = `Rewrite this sentence in a better way: ${text}`; + const prompt = `${text}`; const answer = await ChatServices.invokeLLM(min, prompt); - GBLogEx.info(min, `REWRITE ${text} TO ${answer}`); + GBLogEx.info(min, `REWRITE ${text} TO ${answer.text}`); return answer; } diff --git a/packages/llm.gblib/services/ChatServices.ts b/packages/llm.gblib/services/ChatServices.ts index 1dc485e9..59934b12 100644 --- a/packages/llm.gblib/services/ChatServices.ts +++ b/packages/llm.gblib/services/ChatServices.ts @@ -250,7 +250,7 @@ export class ChatServices { model = await ChatServices.getModel(min); - return await model.invoke(text); + return await model .invoke(text); } public static memoryMap = {}; diff --git a/templates/_drafts/marketing.gbai/marketing.gbdialog/poster.bas b/templates/_drafts/marketing.gbai/marketing.gbdialog/poster.bas deleted file mode 100644 index 875ec99b..00000000 --- a/templates/_drafts/marketing.gbai/marketing.gbdialog/poster.bas +++ /dev/null @@ -1,20 +0,0 @@ -REM SET SCHEDULE "* 8 * * * *" - -user = "user@domain.com" -pass = "*************" -o = get "https://oooooooooo" - -# Criar a legenda para o post -caption = REWRITE "Crie um post sobre produtos, no estilo dica do dia, incluindo 10 hashtags, estilo Instagram o texto! Importante, retorne só a saída de texto pronta" - -# Obter uma imagem relacionada ao conteúdo -image = GET IMAGE caption - -# Postar no Instagram -POST TO INSTAGRAM username, password, image, caption - -# Postar no Facebook -POST TO FACEBOOK username, password, image, caption - -# Postar no BlueSky -BLUESKY username, password, image, caption diff --git a/templates/marketing.gbai/marketing.gbdialog/poster.bas b/templates/marketing.gbai/marketing.gbdialog/poster.bas new file mode 100644 index 00000000..78ce2179 --- /dev/null +++ b/templates/marketing.gbai/marketing.gbdialog/poster.bas @@ -0,0 +1,12 @@ +' SET SCHEDULE "* 8 * * * *" + + + +' Criar a legenda para o post +caption = REWRITE "Crie um post sobre produtos, no estilo dica do dia, incluindo 10 hashtags, estilo Instagram o texto! Importante, retorne só a saída de texto pronta" + +' Obter uma imagem relacionada ao conteúdo +image = GET IMAGE caption + +' Postar no Instagram +POST TO INSTAGRAM username, password, image, caption