new(core.gbapp): LLM alerts for data.

This commit is contained in:
me@rodrigorodriguez.com 2024-10-16 02:50:24 -03:00
parent 52f416076e
commit 789fd79777
4 changed files with 102 additions and 85 deletions

View file

@ -481,6 +481,14 @@ export class KeywordsExpressions {
} }
]; ];
keywords[i++] = [
/^\s*(.*)\=\s*(ANSWER)(\s*)(.*)/gim,
($0, $1, $2, $3, $4) => {
const params = this.getParams($4, ['text']);
return `${$1} = await sys.answer ({pid: pid, ${params}})`;
}
];
keywords[i++] = [ keywords[i++] = [
/^\s*(.*)\=\s*(GET IMAGE)(\s*)(.*)/gim, /^\s*(.*)\=\s*(GET IMAGE)(\s*)(.*)/gim,
($0, $1, $2, $3, $4) => { ($0, $1, $2, $3, $4) => {

View file

@ -2460,6 +2460,16 @@ export class SystemKeywords {
GBLogEx.info(min, `BlueSky Automation: ${text}.`); GBLogEx.info(min, `BlueSky Automation: ${text}.`);
} }
/**
*/
public async answer({ pid, text }) {
const { min, user } = await DialogKeywords.getProcessInfo(pid);
const answer = await ChatServices.answerByLLM(pid, min, user, text)
GBLogEx.info(min, `ANSWER ${text} TO ${answer}`);
return answer.answer;
}
/** /**
* HEAR description * HEAR description
* text = REWRITE description * text = REWRITE description
@ -2903,7 +2913,6 @@ export class SystemKeywords {
// Step 3: Get the list of all tables from the source database // Step 3: Get the list of all tables from the source database
const tables = await GBUtil.listTables(dialect, min.core.sequelize); const tables = await GBUtil.listTables(dialect, min.core.sequelize);
const tableNames = tables.map(table => Object.values(table)[0]);
// Function to map source database datatypes to SQLite-compatible datatypes // Function to map source database datatypes to SQLite-compatible datatypes
const mapToSQLiteType = (columnType) => { const mapToSQLiteType = (columnType) => {
@ -2933,7 +2942,7 @@ export class SystemKeywords {
}; };
// Step 4: Retrieve and export data for each table // Step 4: Retrieve and export data for each table
for (const table of tableNames) { for (const table of tables) {
// Retrieve rows from the source table // Retrieve rows from the source table
const [rows] = await min.core.sequelize.query(`SELECT * FROM ${table}`); const [rows] = await min.core.sequelize.query(`SELECT * FROM ${table}`);

View file

@ -221,7 +221,7 @@ export class GBUtil {
type: QueryTypes.RAW type: QueryTypes.RAW
} }
)[0]; )[0];
} else if (dialect === 'mariadb') { } else {
tables = await seq.getQueryInterface().showAllTables(); tables = await seq.getQueryInterface().showAllTables();
} }
return tables; return tables;

View file

@ -2,6 +2,6 @@ REM SET SCHEDULE
REFRESH "llm" REFRESH "llm"
list = REWRITE "A list of latest 10 orders made." list = ANSWER "A list of latest 10 orders made."
TALK TO admin TALK "The Report is: \n" + list