diff --git a/package.json b/package.json index cf4e473f..59b4f618 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "botbuilder-ai": "4.18.0", "botbuilder-dialogs": "4.18.0", "botframework-connector": "4.18.0", - "botlib": "3.0.0", + "botlib": "3.0.1", "c3-chart-maker": "0.2.8", "chatgpt": "2.4.2", "chrome-remote-interface": "0.31.3", diff --git a/packages/basic.gblib/services/DialogKeywords.ts b/packages/basic.gblib/services/DialogKeywords.ts index 7a9e1b79..86aac2ef 100644 --- a/packages/basic.gblib/services/DialogKeywords.ts +++ b/packages/basic.gblib/services/DialogKeywords.ts @@ -661,7 +661,8 @@ export class DialogKeywords { } private static async downloadAttachmentAndWrite(attachment) { const url = attachment.contentUrl; - const localFolder = Path.join('work'); // TODO: ,'${botId}','uploads'); + // https://github.com/GeneralBots/BotServer/issues/195 - '${botId}','uploads'); + const localFolder = Path.join('work'); const localFileName = Path.join(localFolder, attachment.name); try { @@ -1002,7 +1003,8 @@ export class DialogKeywords { public async gotoDialog({ fromOrDialogName, dialogName }) { if (dialogName) { if (dialogName.charAt(0) === '/') { - // TODO: await step.beginDialog(fromOrDialogName); + // https://github.com/GeneralBots/BotServer/issues/308 + // await step.beginDialog(fromOrDialogName); } else { let sec = new SecService(); let user = await sec.getUserFromSystemId(fromOrDialogName); @@ -1020,7 +1022,8 @@ export class DialogKeywords { await sec.updateUserHearOnDialog(user.userId, dialogName); } } else { - // TODO: await step.beginDialog(fromOrDialogName); + // https://github.com/GeneralBots/BotServer/issues/308 + // await step.beginDialog(fromOrDialogName); } } @@ -1053,7 +1056,7 @@ export class DialogKeywords { private static getChannel(): string { return 'whatsapp'; - // TODO: + // https://github.com/GeneralBots/BotServer/issues/309 } /** diff --git a/packages/basic.gblib/services/GBVMService.ts b/packages/basic.gblib/services/GBVMService.ts index 1c72e7e6..10833db0 100644 --- a/packages/basic.gblib/services/GBVMService.ts +++ b/packages/basic.gblib/services/GBVMService.ts @@ -866,7 +866,8 @@ export class GBVMService extends GBService { keywords[i++] = [ /^\s*(click)(\s*)(.*)/gim, ($0, $1, $2, $3) => { - // TODO: page is not string. + // page is not string. + // https://github.com/GeneralBots/BotServer/issues/310 const params = this.getParams('page,' + $3, ['handle', 'frameOrSelector', 'selector']); return `await wa.click (${params})\n`; } diff --git a/packages/basic.gblib/services/SystemKeywords.ts b/packages/basic.gblib/services/SystemKeywords.ts index 63d23be5..fea81b4f 100644 --- a/packages/basic.gblib/services/SystemKeywords.ts +++ b/packages/basic.gblib/services/SystemKeywords.ts @@ -87,7 +87,7 @@ export class SystemKeywords { } public async callVM ({ text }) { - // TODO: + const min = null; const step = null; const deployer = null; @@ -651,7 +651,6 @@ export class SystemKeywords { * loop * @see NPM package data-forge * - * // TODO: https://www.npmjs.com/package/parse-markdown-table */ public async find ({ args }): Promise { const file = args[0]; @@ -1279,7 +1278,7 @@ export class SystemKeywords { * @example user = get "http://server/users/1" * */ - public async getByHttp ({ url, headers, username, ps, qs, streaming }) { + public async getByHttp ({ url, headers, username, ps, qs}) { let options = { }; if (headers) { options['headers'] = headers; @@ -1293,10 +1292,7 @@ export class SystemKeywords { if (qs) { options['qs'] = qs; } - if (streaming) { // TODO: Do it with fetch. - options['responseType'] = 'stream'; - options['encoding'] = null; - }fetch + const result = await fetch(url, options); try { diff --git a/packages/basic.gblib/services/WebAutomationKeywords.ts b/packages/basic.gblib/services/WebAutomationKeywords.ts index 6d0ab21b..b1519e4d 100644 --- a/packages/basic.gblib/services/WebAutomationKeywords.ts +++ b/packages/basic.gblib/services/WebAutomationKeywords.ts @@ -308,8 +308,10 @@ export class WebAutomationKeywords { */ public async download ({ handle, selector, folder }) { const page = this.getPageByHandle(handle); - const container = page; // TODO: element['_frame'] ? element['_frame'] : element['_page']; + const element = await this.getBySelector({ handle, selector }); + // https://github.com/GeneralBots/BotServer/issues/311 + const container = element['_frame'] ? element['_frame'] : element['_page']; await page.setRequestInterception(true); await container.click(element.originalSelector); diff --git a/packages/boot.gbot/settings.json b/packages/boot.gbot/settings.json index 204b7d09..838ca313 100644 --- a/packages/boot.gbot/settings.json +++ b/packages/boot.gbot/settings.json @@ -2,7 +2,6 @@ "enabledAdmin": "true", "searchScore": ".45", "nlpScore": ".80", - "nlpVsSearch": ".4", "state":"active", "autoPackageSync": "gbdialog, gbot, gbtheme" } diff --git a/packages/core.gbapp/models/GBModel.ts b/packages/core.gbapp/models/GBModel.ts index 56a30e51..203654db 100644 --- a/packages/core.gbapp/models/GBModel.ts +++ b/packages/core.gbapp/models/GBModel.ts @@ -249,9 +249,6 @@ export class GuaribasInstance extends Model implements IGBInst @Column(DataType.STRING(255)) declare adminPass: string; - @Column(DataType.FLOAT) - declare nlpVsSearch: number; // TODO: Remove field. - @Column(DataType.FLOAT) declare searchScore: number; diff --git a/packages/core.gbapp/services/GBConversationalService.ts b/packages/core.gbapp/services/GBConversationalService.ts index 0c18fe08..9ac1824d 100644 --- a/packages/core.gbapp/services/GBConversationalService.ts +++ b/packages/core.gbapp/services/GBConversationalService.ts @@ -571,11 +571,11 @@ export class GBConversationalService { xhtml: false }); - // MSFT Translator breaks markdown, so we need to fix it: + // MSFT Translator breaks markdown, so we need to manually fix it: text = text.replace('! [', '![').replace('] (', ']('); - text = text.replace(`[[embed url=`, process.env.BOT_URL + '/').replace(']]', ''); // TODO: Improve it. - text = text.replace(`](kb`, '](' + process.env.BOT_URL + '/kb'); // TODO: Improve it. + text = text.replace(`[[embed url=`, process.env.BOT_URL + '/').replace(']]', ''); + text = text.replace(`](kb`, '](' + process.env.BOT_URL + '/kb'); if (mobile) { await this.sendMarkdownToMobile(min, step, mobile, text); @@ -597,8 +597,8 @@ export class GBConversationalService { data: { content: html, answer: answer, - prevId: 0, // TODO: answer.prevId, - nextId: 0 // TODO: answer.nextId + prevId: 0, // https://github.com/GeneralBots/BotServer/issues/312 + nextId: 0 } }); } @@ -775,11 +775,7 @@ export class GBConversationalService { } } - // TODO: Update botlib. - public async routeNLP (step: GBDialogStep, min: GBMinInstance, text: string): Promise { - return false; - } - public async routeNLP2 (step: GBDialogStep, min: GBMinInstance, text: string) { + public async routeNLP (step: GBDialogStep, min: GBMinInstance, text: string) { if (min.instance.nlpAppId === null || min.instance.nlpAppId === undefined) { return false; } diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index c3ff044c..9dd0a6dc 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -257,7 +257,8 @@ export class GBMinService { GBServer.globals.appPackages ); - // TODO: min['groupCache'] = await KBService.getGroupReplies(instance.instanceId); + // https://github.com/GeneralBots/BotServer/issues/286 + // min['groupCache'] = await KBService.getGroupReplies(instance.instanceId); GBServer.globals.minInstances.push(min); @@ -298,7 +299,8 @@ export class GBMinService { // Loads Named Entity data for this bot. - // TODO: await KBService.RefreshNER(min); + // https://github.com/GeneralBots/BotServer/issues/217 + // await KBService.RefreshNER(min); // Calls the loadBot context.activity for all packages. @@ -651,7 +653,7 @@ export class GBMinService { min.sandBoxMap = {}; min['scheduleMap'] = {}; min['conversationWelcomed'] = {}; - min['nerEngine'] = new nlp.NlpManager(); // TODO: migrate to MerManager. + min['nerEngine'] = new nlp.NlpManager(); // https://github.com/GeneralBots/BotServer/issues/217 min.packages = sysPackages; min.appPackages = appPackages; @@ -666,7 +668,8 @@ export class GBMinService { access_token: min.instance.facebookWorkplaceAccessToken }); } - // TODO: min.appPackages = core.getPackagesByInstanceId(min.instance.instanceId); + // https://github.com/GeneralBots/BotServer/issues/123 + // min.appPackages = core.getPackagesByInstanceId(min.instance.instanceId); // Creates a hub of services available in .gbapps. @@ -785,7 +788,7 @@ export class GBMinService { }); } - // TODO: Unify in util. + // https://github.com/GeneralBots/BotServer/issues/313 public static userMobile (step) { let mobile = WhatsappDirectLine.mobiles[step.context.activity.conversation.id]; @@ -1080,7 +1083,6 @@ export class GBMinService { let data = { query: context.activity.text }; await CollectionUtil.asyncForEach(min.appPackages, async (e: IGBPackage) => { await e.onExchangeData(min, 'handleRawInput', data); - // TODO: Handle priority over .gbapp, today most common case is just one item per server. }); context.activity.text = data.query; diff --git a/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts b/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts index 6b29476f..aa628a64 100644 --- a/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts +++ b/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts @@ -286,7 +286,7 @@ export class FeedbackDialog extends IGBDialog { min.instance, 'Feedback Improve Message', Messages[fixedLocale].we_will_improve - ); // TODO: Improve to be multi-language. + ); await min.conversationalService.sendText(min, step, message); } diff --git a/packages/google-chat.gblib/services/GoogleChatDirectLine.ts b/packages/google-chat.gblib/services/GoogleChatDirectLine.ts index bcb2cc3d..07d1ea7f 100644 --- a/packages/google-chat.gblib/services/GoogleChatDirectLine.ts +++ b/packages/google-chat.gblib/services/GoogleChatDirectLine.ts @@ -121,7 +121,6 @@ export class GoogleChatDirectLine extends GBService { GBLog.info(`GBGoogleChat: Checking server...`); } - // TODO: Check service.Users.Messages.List("me"). public async receiver (message) { const event = JSON.parse(Buffer.from(message.data, 'binary').toString()); diff --git a/packages/kb.gbapp/dialogs/AskDialog.ts b/packages/kb.gbapp/dialogs/AskDialog.ts index eeaa7b37..1d90bd07 100644 --- a/packages/kb.gbapp/dialogs/AskDialog.ts +++ b/packages/kb.gbapp/dialogs/AskDialog.ts @@ -262,7 +262,7 @@ export class AskDialog extends IGBDialog { // Tries to answer by NLP. - let nextDialog = await min.conversationalService['routeNLP2'](step, min, text); + let nextDialog = await min.conversationalService.routeNLP(step, min, text); if (nextDialog) { return nextDialog; } diff --git a/packages/kb.gbapp/services/KBService.ts b/packages/kb.gbapp/services/KBService.ts index 963ebd7a..788ff01f 100644 --- a/packages/kb.gbapp/services/KBService.ts +++ b/packages/kb.gbapp/services/KBService.ts @@ -307,8 +307,7 @@ export class KBService implements IGBKBService { top: 1 }); - const values = results.results; // TODO: See. - + const values = results.results; let returnedScore = 0; // Searches via Search (Azure Search). @@ -542,7 +541,8 @@ export class KBService implements IGBKBService { }; questions.push(question1); - // TODO: Tutorial. if (lastAnswer !== undefined && lastQuestionId !== 0) { + // https://github.com/GeneralBots/BotServer/issues/312 + // if (lastAnswer !== undefined && lastQuestionId !== 0) { // await lastAnswer.update({ nextId: lastQuestionId }); // } // lastAnswer = answer1; @@ -648,7 +648,7 @@ export class KBService implements IGBKBService { format: '.md', media: file.name, packageId: packageId, - prevId: 0 // TODO: Calculate total rows and increment. + prevId: 0 // https://github.com/GeneralBots/BotServer/issues/312 }); } } diff --git a/packages/security.gbapp/dialogs/ProfileDialog.ts b/packages/security.gbapp/dialogs/ProfileDialog.ts index b13e26b7..5cbefd6f 100644 --- a/packages/security.gbapp/dialogs/ProfileDialog.ts +++ b/packages/security.gbapp/dialogs/ProfileDialog.ts @@ -104,7 +104,7 @@ export class ProfileDialog extends IGBDialog { let phoneNumber; try { let p = phone.PhoneNumberUtil.getInstance(); - phoneNumber = p(step.result, 'BRA')[0]; // TODO: Use accordingly to the person. + phoneNumber = p(step.result, 'BRA')[0]; // https://github.com/GeneralBots/BotServer/issues/307 phoneNumber = phone.phoneUtil.parse(phoneNumber); } catch (error) { await step.context.sendActivity(Messages[locale].validation_enter_valid_mobile); diff --git a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts index b28e542f..d5d8b539 100644 --- a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts +++ b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts @@ -538,7 +538,9 @@ export class WhatsappDirectLine extends GBService { await this.min.conversationalService.sendMarkdownToMobile(this.min, null, user.userSystemId, message); } } else if (text === '/qt') { - // TODO: Transfers only in pt-br for now. + + // https://github.com/GeneralBots/BotServer/issues/307 + await this.sendToDeviceEx( manualUser.userSystemId, Messages[this.locale].notify_end_transfer(this.min.instance.botId),