Skip to content

Commit

Permalink
new(core.gbapp): LLM alerts for data.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Oct 16, 2024
1 parent 789fd79 commit 2a279d2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/basic.gblib/services/SystemKeywords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ export class SystemKeywords {
public async saveToStorageBatch({ pid, table, rows }): Promise<void> {
const { min } = await DialogKeywords.getProcessInfo(pid);

if (typeof rows === 'object' && rows !== null) {
if (!Array.isArray(data) && typeof rows === 'object' && rows !== null) {
rows = [rows];
}

Expand Down
12 changes: 10 additions & 2 deletions packages/llm.gblib/services/ChatServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -545,12 +545,20 @@ export class ChatServices {
} else if (LLMMode === 'sql' || LLMMode === 'chart') {
const con = min[`llm`]['gbconnection'];
const dialect = con['storageDriver'];

const answerSource = await (min.core as any)['getParam'](min.instance,
'Answer Source', false);

let dataSource;
if (dialect === 'sqlite') {
if (dialect === 'sqlite' || answerSource === 'cache') {

let sqliteFilePath = answerSource === 'cache' ?
path.join('work', GBUtil.getGBAIPath(min.botId), `${con['name']}.sqlite`):
con['storageFile'];

dataSource = new DataSource({
type: 'sqlite',
database: con['storageFile'],
database: sqliteFilePath,
synchronize: false,
logging: true
});
Expand Down
1 change: 1 addition & 0 deletions templates/talk-to-data.gbai/talk-to-data.gbot/config.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name,value
Admin, 5521999998888
Answer Mode,sql
Answer Source,cache
llm File,northwind.db
llm Driver,sqlite
Theme Color,red

0 comments on commit 2a279d2

Please sign in to comment.