fix(basic.gblib): TODO removal.

This commit is contained in:
rodrigorodriguez 2022-12-26 13:37:11 -03:00
parent dc94816e47
commit 2b0896521e
15 changed files with 40 additions and 43 deletions

View file

@ -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",

View file

@ -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
}
/**

View file

@ -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`;
}

View file

@ -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<any> {
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 {

View file

@ -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);

View file

@ -2,7 +2,6 @@
"enabledAdmin": "true",
"searchScore": ".45",
"nlpScore": ".80",
"nlpVsSearch": ".4",
"state":"active",
"autoPackageSync": "gbdialog, gbot, gbtheme"
}

View file

@ -249,9 +249,6 @@ export class GuaribasInstance extends Model<GuaribasInstance> implements IGBInst
@Column(DataType.STRING(255))
declare adminPass: string;
@Column(DataType.FLOAT)
declare nlpVsSearch: number; // TODO: Remove field.
@Column(DataType.FLOAT)
declare searchScore: number;

View file

@ -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<boolean> {
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;
}

View file

@ -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;

View file

@ -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);
}

View file

@ -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());

View file

@ -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;
}

View file

@ -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
});
}
}

View file

@ -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);

View file

@ -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),