fix (all): path and fs normalization.

This commit is contained in:
Rodrigo Rodriguez 2024-09-09 10:28:38 -03:00
parent 145406cab3
commit 271ab87dce
6 changed files with 27 additions and 85 deletions

View file

@ -795,43 +795,6 @@ export class SystemKeywords {
* @example SAVE "Billing", columnName1, columnName2
*
*/
public async saveToStorage({ pid, table, fieldsValues, fieldsNames }): Promise<any> {
if (!fieldsValues || fieldsValues.length === 0 || !fieldsValues[0]) {
return;
}
const { min } = await DialogKeywords.getProcessInfo(pid);
GBLogEx.info(min, `SAVE '${table}': 1 row.`);
const definition = this.getTableFromName(table, min);
// Uppercases fields.
let dst = {};
let i = 0;
Object.keys(fieldsValues).forEach(fieldSrc => {
const field = fieldsNames[i].charAt(0).toUpperCase() + fieldsNames[i].slice(1);
dst[field] = fieldsValues[fieldSrc];
i++;
});
dst = null;
let item;
await retry(
async bail => {
item = await definition.create(dst);
},
{
retries: 5,
onRetry: err => {
GBLog.error(`Retrying SaveToStorage due to: ${err.message}.`);
}
}
);
return item;
}
public async saveToStorageWithJSON({ pid, table, fieldsValues, fieldsNames }): Promise<any> {
const { min, user } = await DialogKeywords.getProcessInfo(pid);

View file

@ -155,7 +155,7 @@ export class GBDeployer implements IGBDeployer {
(await fs.readdir(source))
.map(name => path.join(source, name))
.filter(isDirectory);
const dirs = getDirectories(directory);
const dirs = await getDirectories(directory);
await CollectionUtil.asyncForEach(dirs, async element => {
// For each folder, checks its extensions looking for valid packages.

View file

@ -0,0 +1,20 @@
PARAM nome AS string LIKE "João Silva" DESCRIPTION "Required full name of the individual."
PARAM datanasc AS date LIKE "23/09/2001" DESCRIPTION "Required birth date of the individual in DD/MM/YYYY format."
PARAM email AS string LIKE "joao.silva@example.com" DESCRIPTION "Required email address for contact purposes."
PARAM cpf AS integer LIKE "12345678900" DESCRIPTION "Required CPF number of the individual (only numbers)."
PARAM rg AS integer LIKE "12345678" DESCRIPTION "Required RG or CNH number of the individual (only numbers)."
PARAM orgaorg AS string LIKE "SSP-SP" DESCRIPTION "Required issuing authority of the individual's RG or CNH."
PARAM dataemite AS date LIKE "15/08/2007" DESCRIPTION "Required issue date of the individual's RG or CNH in DD/MM/YYYY format."
PARAM ender AS string LIKE "Rua das Flores, 123, São Paulo, SP" DESCRIPTION "Required full address of the individual."
PARAM nomealuno AS string LIKE "Ana Silva" DESCRIPTION "Required full name of the student for enrollment."
PARAM cpfaluno AS integer LIKE "98765432100" DESCRIPTION "Required CPF number of the student (only numbers)."
PARAM datanascaluno AS date LIKE "07/03/2010" DESCRIPTION "Required birth date of the student in DD/MM/YYYY format."
PARAM rgaluno AS integer LIKE "87654321" DESCRIPTION "Required RG number of the student (only numbers)."
PARAM orgaoaluno AS string LIKE "SSP-SP" DESCRIPTION "Required issuing authority of the student's RG or CNH."
PARAM emissaoaluno AS date LIKE "10/05/2015" DESCRIPTION "Required issue date of the student's RG or CNH in DD/MM/YYYY format."
PARAM respfinaluno AS string LIKE "Maria Oliveira" DESCRIPTION "Required full name of the financial responsible party for the student."
DESCRIPTION "This is a the enrollment process, called when the user wants to enrol. Once all information is collected, confirm the details and inform them that their enrollment request has been successfully submitted. Provide a polite and professional tone throughout the interaction."
SAVE "enrollments.csv", id, from, nome, datanasc, email, cpf, rg, orgaorg, dataemite, ender, nomealuno, cpfaluno, datanascaluno

View file

@ -1,47 +1,3 @@
REM SEND FILE “logo.png”
SAVE Log.xlsx, from, mobile, today, now, "start"
TALK "Olá " + username + , eu sou o *Bot*.
row = FIND People.xlsx, mobile= + from
IF row = null THEN
TALK Verifiquei que é seu primeiro contato conosco por aqui. Vamos fazer o seu cadastro e realizar a matrícula logo em seguida.
TALK Por favor, me informe o seu *Nome Completo*:
HEAR nome AS NAME
TALK Qual a sua *data de nascimento*? Exemplo: 23/09/2001.
HEAR datanasc AS DATE
TALK Informe por favor, um *e-mail* pra contato.
HEAR email as EMAIL
TALK Por favor, me informe o seu *CPF* (apenas números).
HEAR cpf AS INTEGER
TALK Qual o *número do seu RG ou CNH* (apenas números, por favor)?
HEAR rg AS INTEGER
TALK Qual o *Órgão emissor* do seu RG ou CNH?
HEAR orgaorg
TALK Qual a *data de emissão* do seu *RG* ou *CNH*? Exemplo: 15/08/2007
HEAR dataemite AS DATE
TALK Qual o seu endereço completo?
HEAR ender
TALK Pronto! Agora vamos realizar a matrícula do aluno.\n\nPor favor, me informe o *Nome Completo*:
HEAR nomealuno AS NAME
TALK Me informe o *CPF* (apenas números) do aluno:
HEAR cpfaluno as INTEGER
TALK Qual a *data de nascimento* do aluno? Exemplo: 07/03/2010
HEAR datanascaluno AS DATE
TALK Qual o *RG* (apenas números) do aluno?
HEAR rgaluno AS DATE
TALK Qual o *Órgão Emissor* do documento?
HEAR orgaoaluno
TALK Qual o *Data de Emissão* do documento?
HEAR emissaoaluno AS DATE
TALK Qual o nome do responsável financeiro do aluno?
HEAR respfinaluno AS NAME
TALK Vou registrar agora estes dados, um instante por favor...
SAVE People.xlsx, id, from, nome, datanasc, email, cpf, rg, orgaorg, dataemite, ender, nomealuno, cpfaluno, datanascaluno
TALK "Pronto, + username + ! O cadastro foi realizado. Iremos entrar em contato. \n\nObrigado!"
ELSE
SAVE Log.xlsx, from, mobile, today, now, hello
TALK Olá, + username + ! Bem-vinda(o) de volta. Você pode tirar dúvidas comigo sobre a secretaria.
END IF
BEGIN SYSTEM PROMPT
Act as an AI assistant for an educational institution. Your role is to help users with enrollment, provide information about courses, answer admissions-related questions, and guide them through the registration process. Ensure a friendly, professional tone while offering clear, accurate assistance to reduce administrative workload and enhance the user experience.
END SySTEM PROMPT

View file

@ -0,0 +1,3 @@
name,value
Answer Mode,tool
Start Dialog,start
1 name value
2 Answer Mode tool
3 Start Dialog start