fix(basic.gblib): TODO removal.
This commit is contained in:
parent
dc94816e47
commit
2b0896521e
15 changed files with 40 additions and 43 deletions
|
@ -85,7 +85,7 @@
|
||||||
"botbuilder-ai": "4.18.0",
|
"botbuilder-ai": "4.18.0",
|
||||||
"botbuilder-dialogs": "4.18.0",
|
"botbuilder-dialogs": "4.18.0",
|
||||||
"botframework-connector": "4.18.0",
|
"botframework-connector": "4.18.0",
|
||||||
"botlib": "3.0.0",
|
"botlib": "3.0.1",
|
||||||
"c3-chart-maker": "0.2.8",
|
"c3-chart-maker": "0.2.8",
|
||||||
"chatgpt": "2.4.2",
|
"chatgpt": "2.4.2",
|
||||||
"chrome-remote-interface": "0.31.3",
|
"chrome-remote-interface": "0.31.3",
|
||||||
|
|
|
@ -661,7 +661,8 @@ export class DialogKeywords {
|
||||||
}
|
}
|
||||||
private static async downloadAttachmentAndWrite(attachment) {
|
private static async downloadAttachmentAndWrite(attachment) {
|
||||||
const url = attachment.contentUrl;
|
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);
|
const localFileName = Path.join(localFolder, attachment.name);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -1002,7 +1003,8 @@ export class DialogKeywords {
|
||||||
public async gotoDialog({ fromOrDialogName, dialogName }) {
|
public async gotoDialog({ fromOrDialogName, dialogName }) {
|
||||||
if (dialogName) {
|
if (dialogName) {
|
||||||
if (dialogName.charAt(0) === '/') {
|
if (dialogName.charAt(0) === '/') {
|
||||||
// TODO: await step.beginDialog(fromOrDialogName);
|
// https://github.com/GeneralBots/BotServer/issues/308
|
||||||
|
// await step.beginDialog(fromOrDialogName);
|
||||||
} else {
|
} else {
|
||||||
let sec = new SecService();
|
let sec = new SecService();
|
||||||
let user = await sec.getUserFromSystemId(fromOrDialogName);
|
let user = await sec.getUserFromSystemId(fromOrDialogName);
|
||||||
|
@ -1020,7 +1022,8 @@ export class DialogKeywords {
|
||||||
await sec.updateUserHearOnDialog(user.userId, dialogName);
|
await sec.updateUserHearOnDialog(user.userId, dialogName);
|
||||||
}
|
}
|
||||||
} else {
|
} 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 {
|
private static getChannel(): string {
|
||||||
return 'whatsapp';
|
return 'whatsapp';
|
||||||
// TODO:
|
// https://github.com/GeneralBots/BotServer/issues/309
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -866,7 +866,8 @@ export class GBVMService extends GBService {
|
||||||
keywords[i++] = [
|
keywords[i++] = [
|
||||||
/^\s*(click)(\s*)(.*)/gim,
|
/^\s*(click)(\s*)(.*)/gim,
|
||||||
($0, $1, $2, $3) => {
|
($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']);
|
const params = this.getParams('page,' + $3, ['handle', 'frameOrSelector', 'selector']);
|
||||||
return `await wa.click (${params})\n`;
|
return `await wa.click (${params})\n`;
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ export class SystemKeywords {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async callVM ({ text }) {
|
public async callVM ({ text }) {
|
||||||
// TODO:
|
|
||||||
const min = null;
|
const min = null;
|
||||||
const step = null;
|
const step = null;
|
||||||
const deployer = null;
|
const deployer = null;
|
||||||
|
@ -651,7 +651,6 @@ export class SystemKeywords {
|
||||||
* loop
|
* loop
|
||||||
* @see NPM package data-forge
|
* @see NPM package data-forge
|
||||||
*
|
*
|
||||||
* // TODO: https://www.npmjs.com/package/parse-markdown-table
|
|
||||||
*/
|
*/
|
||||||
public async find ({ args }): Promise<any> {
|
public async find ({ args }): Promise<any> {
|
||||||
const file = args[0];
|
const file = args[0];
|
||||||
|
@ -1279,7 +1278,7 @@ export class SystemKeywords {
|
||||||
* @example user = get "http://server/users/1"
|
* @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 = { };
|
let options = { };
|
||||||
if (headers) {
|
if (headers) {
|
||||||
options['headers'] = headers;
|
options['headers'] = headers;
|
||||||
|
@ -1293,10 +1292,7 @@ export class SystemKeywords {
|
||||||
if (qs) {
|
if (qs) {
|
||||||
options['qs'] = qs;
|
options['qs'] = qs;
|
||||||
}
|
}
|
||||||
if (streaming) { // TODO: Do it with fetch.
|
|
||||||
options['responseType'] = 'stream';
|
|
||||||
options['encoding'] = null;
|
|
||||||
}fetch
|
|
||||||
const result = await fetch(url, options);
|
const result = await fetch(url, options);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -308,8 +308,10 @@ export class WebAutomationKeywords {
|
||||||
*/
|
*/
|
||||||
public async download ({ handle, selector, folder }) {
|
public async download ({ handle, selector, folder }) {
|
||||||
const page = this.getPageByHandle(handle);
|
const page = this.getPageByHandle(handle);
|
||||||
const container = page; // TODO: element['_frame'] ? element['_frame'] : element['_page'];
|
|
||||||
const element = await this.getBySelector({ handle, selector });
|
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 page.setRequestInterception(true);
|
||||||
await container.click(element.originalSelector);
|
await container.click(element.originalSelector);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
"enabledAdmin": "true",
|
"enabledAdmin": "true",
|
||||||
"searchScore": ".45",
|
"searchScore": ".45",
|
||||||
"nlpScore": ".80",
|
"nlpScore": ".80",
|
||||||
"nlpVsSearch": ".4",
|
|
||||||
"state":"active",
|
"state":"active",
|
||||||
"autoPackageSync": "gbdialog, gbot, gbtheme"
|
"autoPackageSync": "gbdialog, gbot, gbtheme"
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,9 +249,6 @@ export class GuaribasInstance extends Model<GuaribasInstance> implements IGBInst
|
||||||
@Column(DataType.STRING(255))
|
@Column(DataType.STRING(255))
|
||||||
declare adminPass: string;
|
declare adminPass: string;
|
||||||
|
|
||||||
@Column(DataType.FLOAT)
|
|
||||||
declare nlpVsSearch: number; // TODO: Remove field.
|
|
||||||
|
|
||||||
@Column(DataType.FLOAT)
|
@Column(DataType.FLOAT)
|
||||||
declare searchScore: number;
|
declare searchScore: number;
|
||||||
|
|
||||||
|
|
|
@ -571,11 +571,11 @@ export class GBConversationalService {
|
||||||
xhtml: false
|
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('! [', '![').replace('] (', '](');
|
||||||
text = text.replace(`[[embed url=`, process.env.BOT_URL + '/').replace(']]', ''); // TODO: Improve it.
|
text = text.replace(`[[embed url=`, process.env.BOT_URL + '/').replace(']]', '');
|
||||||
text = text.replace(`](kb`, '](' + process.env.BOT_URL + '/kb'); // TODO: Improve it.
|
text = text.replace(`](kb`, '](' + process.env.BOT_URL + '/kb');
|
||||||
|
|
||||||
if (mobile) {
|
if (mobile) {
|
||||||
await this.sendMarkdownToMobile(min, step, mobile, text);
|
await this.sendMarkdownToMobile(min, step, mobile, text);
|
||||||
|
@ -597,8 +597,8 @@ export class GBConversationalService {
|
||||||
data: {
|
data: {
|
||||||
content: html,
|
content: html,
|
||||||
answer: answer,
|
answer: answer,
|
||||||
prevId: 0, // TODO: answer.prevId,
|
prevId: 0, // https://github.com/GeneralBots/BotServer/issues/312
|
||||||
nextId: 0 // TODO: answer.nextId
|
nextId: 0
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -775,11 +775,7 @@ export class GBConversationalService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Update botlib.
|
public async routeNLP (step: GBDialogStep, min: GBMinInstance, text: string) {
|
||||||
public async routeNLP (step: GBDialogStep, min: GBMinInstance, text: string): Promise<boolean> {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
public async routeNLP2 (step: GBDialogStep, min: GBMinInstance, text: string) {
|
|
||||||
if (min.instance.nlpAppId === null || min.instance.nlpAppId === undefined) {
|
if (min.instance.nlpAppId === null || min.instance.nlpAppId === undefined) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,7 +257,8 @@ export class GBMinService {
|
||||||
GBServer.globals.appPackages
|
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);
|
GBServer.globals.minInstances.push(min);
|
||||||
|
|
||||||
|
@ -298,7 +299,8 @@ export class GBMinService {
|
||||||
|
|
||||||
// Loads Named Entity data for this bot.
|
// 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.
|
// Calls the loadBot context.activity for all packages.
|
||||||
|
|
||||||
|
@ -651,7 +653,7 @@ export class GBMinService {
|
||||||
min.sandBoxMap = {};
|
min.sandBoxMap = {};
|
||||||
min['scheduleMap'] = {};
|
min['scheduleMap'] = {};
|
||||||
min['conversationWelcomed'] = {};
|
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.packages = sysPackages;
|
||||||
min.appPackages = appPackages;
|
min.appPackages = appPackages;
|
||||||
|
|
||||||
|
@ -666,7 +668,8 @@ export class GBMinService {
|
||||||
access_token: min.instance.facebookWorkplaceAccessToken
|
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.
|
// 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) {
|
public static userMobile (step) {
|
||||||
let mobile = WhatsappDirectLine.mobiles[step.context.activity.conversation.id];
|
let mobile = WhatsappDirectLine.mobiles[step.context.activity.conversation.id];
|
||||||
|
|
||||||
|
@ -1080,7 +1083,6 @@ export class GBMinService {
|
||||||
let data = { query: context.activity.text };
|
let data = { query: context.activity.text };
|
||||||
await CollectionUtil.asyncForEach(min.appPackages, async (e: IGBPackage) => {
|
await CollectionUtil.asyncForEach(min.appPackages, async (e: IGBPackage) => {
|
||||||
await e.onExchangeData(min, 'handleRawInput', data);
|
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;
|
context.activity.text = data.query;
|
||||||
|
|
||||||
|
|
|
@ -286,7 +286,7 @@ export class FeedbackDialog extends IGBDialog {
|
||||||
min.instance,
|
min.instance,
|
||||||
'Feedback Improve Message',
|
'Feedback Improve Message',
|
||||||
Messages[fixedLocale].we_will_improve
|
Messages[fixedLocale].we_will_improve
|
||||||
); // TODO: Improve to be multi-language.
|
);
|
||||||
|
|
||||||
await min.conversationalService.sendText(min, step, message);
|
await min.conversationalService.sendText(min, step, message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,6 @@ export class GoogleChatDirectLine extends GBService {
|
||||||
GBLog.info(`GBGoogleChat: Checking server...`);
|
GBLog.info(`GBGoogleChat: Checking server...`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Check service.Users.Messages.List("me").
|
|
||||||
public async receiver (message) {
|
public async receiver (message) {
|
||||||
const event = JSON.parse(Buffer.from(message.data, 'binary').toString());
|
const event = JSON.parse(Buffer.from(message.data, 'binary').toString());
|
||||||
|
|
||||||
|
|
|
@ -262,7 +262,7 @@ export class AskDialog extends IGBDialog {
|
||||||
|
|
||||||
// Tries to answer by NLP.
|
// 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) {
|
if (nextDialog) {
|
||||||
return nextDialog;
|
return nextDialog;
|
||||||
}
|
}
|
||||||
|
|
|
@ -307,8 +307,7 @@ export class KBService implements IGBKBService {
|
||||||
top: 1
|
top: 1
|
||||||
});
|
});
|
||||||
|
|
||||||
const values = results.results; // TODO: See.
|
const values = results.results;
|
||||||
|
|
||||||
let returnedScore = 0;
|
let returnedScore = 0;
|
||||||
|
|
||||||
// Searches via Search (Azure Search).
|
// Searches via Search (Azure Search).
|
||||||
|
@ -542,7 +541,8 @@ export class KBService implements IGBKBService {
|
||||||
};
|
};
|
||||||
questions.push(question1);
|
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 });
|
// await lastAnswer.update({ nextId: lastQuestionId });
|
||||||
// }
|
// }
|
||||||
// lastAnswer = answer1;
|
// lastAnswer = answer1;
|
||||||
|
@ -648,7 +648,7 @@ export class KBService implements IGBKBService {
|
||||||
format: '.md',
|
format: '.md',
|
||||||
media: file.name,
|
media: file.name,
|
||||||
packageId: packageId,
|
packageId: packageId,
|
||||||
prevId: 0 // TODO: Calculate total rows and increment.
|
prevId: 0 // https://github.com/GeneralBots/BotServer/issues/312
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ export class ProfileDialog extends IGBDialog {
|
||||||
let phoneNumber;
|
let phoneNumber;
|
||||||
try {
|
try {
|
||||||
let p = phone.PhoneNumberUtil.getInstance();
|
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);
|
phoneNumber = phone.phoneUtil.parse(phoneNumber);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await step.context.sendActivity(Messages[locale].validation_enter_valid_mobile);
|
await step.context.sendActivity(Messages[locale].validation_enter_valid_mobile);
|
||||||
|
|
|
@ -538,7 +538,9 @@ export class WhatsappDirectLine extends GBService {
|
||||||
await this.min.conversationalService.sendMarkdownToMobile(this.min, null, user.userSystemId, message);
|
await this.min.conversationalService.sendMarkdownToMobile(this.min, null, user.userSystemId, message);
|
||||||
}
|
}
|
||||||
} else if (text === '/qt') {
|
} else if (text === '/qt') {
|
||||||
// TODO: Transfers only in pt-br for now.
|
|
||||||
|
// https://github.com/GeneralBots/BotServer/issues/307
|
||||||
|
|
||||||
await this.sendToDeviceEx(
|
await this.sendToDeviceEx(
|
||||||
manualUser.userSystemId,
|
manualUser.userSystemId,
|
||||||
Messages[this.locale].notify_end_transfer(this.min.instance.botId),
|
Messages[this.locale].notify_end_transfer(this.min.instance.botId),
|
||||||
|
|
Loading…
Add table
Reference in a new issue