fix(all): TODO items removed or moved to ALM.
This commit is contained in:
parent
7344a8e7dd
commit
7348c54894
5 changed files with 145 additions and 156 deletions
|
@ -937,9 +937,7 @@ export class GBMinService {
|
||||||
// Required for F0 handling of persisted conversations.
|
// Required for F0 handling of persisted conversations.
|
||||||
|
|
||||||
GBLog.info(
|
GBLog.info(
|
||||||
`Input> ${context.activity.text} (type: ${context.activity.type}, name: ${
|
`Input> ${context.activity.text} (type: ${context.activity.type}, name: ${context.activity.name}, channelId: ${context.activity.channelId})`
|
||||||
context.activity.name
|
|
||||||
}, channelId: ${context.activity.channelId})`
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Answer to specific BOT Framework event conversationUpdate to auto start dialogs.
|
// Answer to specific BOT Framework event conversationUpdate to auto start dialogs.
|
||||||
|
@ -1065,6 +1063,16 @@ export class GBMinService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Checks for global exit kewywords cancelling any active dialogs.
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
|
||||||
|
public static isGlobalQuitUtterance(locale, utterance) {
|
||||||
|
return utterance.match(Messages.global_quit);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to handle all text messages sent and received by the bot.
|
* Called to handle all text messages sent and received by the bot.
|
||||||
*/
|
*/
|
||||||
|
@ -1109,12 +1117,6 @@ export class GBMinService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks for global exit kewywords cancelling any active dialogs.
|
|
||||||
|
|
||||||
const globalQuit = (locale, utterance) => {
|
|
||||||
return utterance.match(Messages.global_quit);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Files in .gbdialog can be called directly by typing its name normalized into JS .
|
// Files in .gbdialog can be called directly by typing its name normalized into JS .
|
||||||
|
|
||||||
const isVMCall = Object.keys(min.scriptMap).find(key => min.scriptMap[key] === context.activity.text) !== undefined;
|
const isVMCall = Object.keys(min.scriptMap).find(key => min.scriptMap[key] === context.activity.text) !== undefined;
|
||||||
|
@ -1142,7 +1144,7 @@ export class GBMinService {
|
||||||
} else {
|
} else {
|
||||||
await step.beginDialog(cmdOrDialogName, { args: args });
|
await step.beginDialog(cmdOrDialogName, { args: args });
|
||||||
}
|
}
|
||||||
} else if (globalQuit(step.context.activity.locale, context.activity.text)) {
|
} else if (GBMinService.isGlobalQuitUtterance(step.context.activity.locale, context.activity.text)) {
|
||||||
await step.cancelAllDialogs();
|
await step.cancelAllDialogs();
|
||||||
await min.conversationalService.sendText(min, step, Messages[step.context.activity.locale].canceled);
|
await min.conversationalService.sendText(min, step, Messages[step.context.activity.locale].canceled);
|
||||||
} else if (context.activity.text === 'admin') {
|
} else if (context.activity.text === 'admin') {
|
||||||
|
|
|
@ -54,9 +54,6 @@ else
|
||||||
talk "The maximum number of payments is 60"
|
talk "The maximum number of payments is 60"
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
|
||||||
' TODO: This must be reviewed in terms of financing logic.
|
|
||||||
|
|
||||||
nInstallments = parseInt(installments)
|
nInstallments = parseInt(installments)
|
||||||
vamount = parseFloat(amount)
|
vamount = parseFloat(amount)
|
||||||
initialPayment = vamount * 0.3 ' 30% of the value
|
initialPayment = vamount * 0.3 ' 30% of the value
|
||||||
|
|
|
@ -185,7 +185,6 @@ export class SecService extends GBService {
|
||||||
item !== userSystemId &&
|
item !== userSystemId &&
|
||||||
!(await this.isAgentSystemId(item))
|
!(await this.isAgentSystemId(item))
|
||||||
) {
|
) {
|
||||||
// TODO: Optimize loop.
|
|
||||||
agentSystemId = item;
|
agentSystemId = item;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -34,7 +34,7 @@ import urlJoin from 'url-join';
|
||||||
import Swagger from 'swagger-client';
|
import Swagger from 'swagger-client';
|
||||||
import Path from 'path';
|
import Path from 'path';
|
||||||
import Fs from 'fs';
|
import Fs from 'fs';
|
||||||
import { GBLog, GBMinInstance, GBService, IGBPackage } from 'botlib';
|
import { GBError, GBLog, GBMinInstance, GBService, IGBPackage } from 'botlib';
|
||||||
import { CollectionUtil } from 'pragmatismo-io-framework';
|
import { CollectionUtil } from 'pragmatismo-io-framework';
|
||||||
import { GBServer } from '../../../src/app.js';
|
import { GBServer } from '../../../src/app.js';
|
||||||
import { GBConversationalService } from '../../core.gbapp/services/GBConversationalService.js';
|
import { GBConversationalService } from '../../core.gbapp/services/GBConversationalService.js';
|
||||||
|
@ -310,10 +310,8 @@ export class WhatsappDirectLine extends GBService {
|
||||||
public async check() {
|
public async check() {
|
||||||
switch (this.provider) {
|
switch (this.provider) {
|
||||||
case 'GeneralBots':
|
case 'GeneralBots':
|
||||||
|
return this.customClient.getState() === 'CONNECTED';
|
||||||
|
|
||||||
// TODO: Verify if browser is OK.
|
|
||||||
|
|
||||||
return true;
|
|
||||||
default:
|
default:
|
||||||
GBLog.verbose(`GBWhatsapp: Checking server...`);
|
GBLog.verbose(`GBWhatsapp: Checking server...`);
|
||||||
let url = urlJoin(this.whatsappServiceUrl, 'status') + `?token=${this.min.instance.whatsappServiceKey}`;
|
let url = urlJoin(this.whatsappServiceUrl, 'status') + `?token=${this.min.instance.whatsappServiceKey}`;
|
||||||
|
@ -323,7 +321,7 @@ export class WhatsappDirectLine extends GBService {
|
||||||
};
|
};
|
||||||
|
|
||||||
const res = await fetch(url, options);
|
const res = await fetch(url, options);
|
||||||
const json = (await res.json());
|
const json = await res.json();
|
||||||
return json['accountStatus'] === 'authenticated';
|
return json['accountStatus'] === 'authenticated';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -538,7 +536,6 @@ 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') {
|
||||||
|
|
||||||
// https://github.com/GeneralBots/BotServer/issues/307
|
// https://github.com/GeneralBots/BotServer/issues/307
|
||||||
|
|
||||||
await this.sendToDeviceEx(
|
await this.sendToDeviceEx(
|
||||||
|
@ -579,8 +576,7 @@ export class WhatsappDirectLine extends GBService {
|
||||||
locale,
|
locale,
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
} else if (text === '/qt' || text === 'Sair' || text === 'Fechar') {
|
} else if (text === '/qt' || GBMinService.isGlobalQuitUtterance(locale, text)) {
|
||||||
// TODO: Transfers only in pt-br for now.
|
|
||||||
await this.endTransfer(from, locale, user, agent, sec);
|
await this.endTransfer(from, locale, user, agent, sec);
|
||||||
} else {
|
} else {
|
||||||
GBLog.info(`USER (${from}) TO AGENT ${agent.userSystemId}: ${text}`);
|
GBLog.info(`USER (${from}) TO AGENT ${agent.userSystemId}: ${text}`);
|
||||||
|
@ -836,9 +832,7 @@ export class WhatsappDirectLine extends GBService {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'maytapi':
|
case 'maytapi':
|
||||||
options = {}; // TODO: Code Maytapi.
|
throw GBError.create('Sending audio in Maytapi not supported.');
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options) {
|
if (options) {
|
||||||
|
@ -920,8 +914,6 @@ export class WhatsappDirectLine extends GBService {
|
||||||
await fetch(url, options);
|
await fetch(url, options);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
GBLog.error(`Error sending message to Whatsapp provider ${error.message}`);
|
GBLog.error(`Error sending message to Whatsapp provider ${error.message}`);
|
||||||
|
|
||||||
// TODO: Handle Error: socket hang up and retry.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,7 +127,6 @@ export class GBServer {
|
||||||
if (proxy !== undefined) {
|
if (proxy !== undefined) {
|
||||||
GBServer.globals.publicAddress = proxy;
|
GBServer.globals.publicAddress = proxy;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Ensure that local development proxy is setup.
|
// Ensure that local development proxy is setup.
|
||||||
|
|
||||||
GBLog.info(`Establishing a development local proxy (ngrok)...`);
|
GBLog.info(`Establishing a development local proxy (ngrok)...`);
|
||||||
|
@ -224,15 +223,15 @@ export class GBServer {
|
||||||
|
|
||||||
const loggers = GBLog.getLogger();
|
const loggers = GBLog.getLogger();
|
||||||
winston.default(server, loggers[1]);
|
winston.default(server, loggers[1]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GBLog.info(`The Bot Server is in RUNNING mode...`);
|
GBLog.info(`The Bot Server is in RUNNING mode...`);
|
||||||
|
|
||||||
// Opens Navigator.
|
// Opens Navigator.
|
||||||
|
|
||||||
// TODO: Config: core.openBrowserInDevelopment();
|
if (process.env.DEV_OPEN_BROWSER) {
|
||||||
|
core.openBrowserInDevelopment();
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
GBLog.error(`STOP: ${err.message ? err.message : err} ${err.stack ? err.stack : ''}`);
|
GBLog.error(`STOP: ${err.message ? err.message : err} ${err.stack ? err.stack : ''}`);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
@ -240,7 +239,7 @@ export class GBServer {
|
||||||
})();
|
})();
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: Move to .gbot folder myown.com pointing to generalbots.ai/myown.
|
//
|
||||||
|
|
||||||
if (process.env.CERTIFICATE_PFX) {
|
if (process.env.CERTIFICATE_PFX) {
|
||||||
const options1 = {
|
const options1 = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue