fix (templates): edu OK.
This commit is contained in:
parent
d43a0796b6
commit
6cdce1b9ee
3 changed files with 77 additions and 17 deletions
|
@ -2795,4 +2795,69 @@ export class SystemKeywords {
|
||||||
|
|
||||||
GBLogEx.info(min, `LLM Mode (${user.userSystemId}): ${mode}`);
|
GBLogEx.info(min, `LLM Mode (${user.userSystemId}): ${mode}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves variables to storage, not a worksheet.
|
||||||
|
*
|
||||||
|
* @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.`);
|
||||||
|
|
||||||
|
// Uppercase fields
|
||||||
|
const dst = {};
|
||||||
|
fieldsNames.forEach((fieldName, index) => {
|
||||||
|
const field = fieldName.charAt(0).toUpperCase() + fieldName.slice(1);
|
||||||
|
dst[field] = fieldsValues[Object.keys(fieldsValues)[index]];
|
||||||
|
});
|
||||||
|
|
||||||
|
let item;
|
||||||
|
await retry(
|
||||||
|
async bail => {
|
||||||
|
if (table.endsWith('.csv')) {
|
||||||
|
// CSV handling
|
||||||
|
const packagePath = GBUtil.getGBAIPath(min.botId, "gbdata");
|
||||||
|
const csvFile = path.join(GBConfigService.get('STORAGE_LIBRARY'), packagePath, `${table}`);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Try to read the file to get headers
|
||||||
|
const data = await fs.readFile(csvFile, 'utf8');
|
||||||
|
const headers = data.split('\n')[0].split(',');
|
||||||
|
const db = await csvdb(csvFile, headers, ',');
|
||||||
|
|
||||||
|
// Append new row
|
||||||
|
await db.add(dst);
|
||||||
|
item = dst;
|
||||||
|
} catch (error) {
|
||||||
|
if (error.code === 'ENOENT') {
|
||||||
|
// File doesn't exist, create it with headers and data
|
||||||
|
const headers = Object.keys(dst);
|
||||||
|
await fs.writeFile(csvFile, headers.join(',') + '\n');
|
||||||
|
const db = await csvdb(csvFile, headers, ',');
|
||||||
|
await db.add(dst);
|
||||||
|
item = dst;
|
||||||
|
} else {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const definition = this.getTableFromName(table, min);
|
||||||
|
item = await definition.create(dst);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
retries: 5,
|
||||||
|
onRetry: err => {
|
||||||
|
GBLog.error(`Retrying SaveToStorage due to: ${err.message}.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,10 @@
|
||||||
PARAM nome AS string LIKE "João Silva" DESCRIPTION "Required full name of the individual."
|
PARAM name 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 birthday 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 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 personalid AS integer LIKE "12345678900" DESCRIPTION "Required Personal ID number of the individual (only numbers)."
|
||||||
PARAM rg AS integer LIKE "12345678" DESCRIPTION "Required RG or CNH number of the individual (only numbers)."
|
PARAM address AS string LIKE "Rua das Flores, 123, São Paulo, SP" DESCRIPTION "Required full address of the individual."
|
||||||
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."
|
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
|
SAVE "enrollments.csv", id, name, birthday, email, cpf, rg, address
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
BEGIN SYSTEM PROMPT
|
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.
|
Act as an AI assistant for an educational institution.
|
||||||
END SySTEM PROMPT
|
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
|
Loading…
Add table
Reference in a new issue