new(all): GBLogEx published.
This commit is contained in:
parent
76c3783ff9
commit
d392c0082d
4 changed files with 3 additions and 24 deletions
|
@ -209,7 +209,6 @@
|
|||
"twitter-api-v2": "1.12.9",
|
||||
"typescript": "4.9.5",
|
||||
"url-join": "5.0.0",
|
||||
"vbscript-to-typescript": "1.0.8",
|
||||
"vhost": "3.0.2",
|
||||
"vm2": "3.9.11",
|
||||
"vm2-process": "2.1.1",
|
||||
|
@ -217,7 +216,6 @@
|
|||
"washyourmouthoutwithsoap": "1.0.2",
|
||||
"whatsapp-web.js": "https://github.com/Julzk/whatsapp-web.js/tarball/jkr_hotfix_7",
|
||||
"winston": "3.8.2",
|
||||
"winston-logs-display": "1.0.0",
|
||||
"ws": "8.14.2",
|
||||
"yarn": "1.22.19",
|
||||
"zod-to-json-schema": "^3.22.4"
|
||||
|
|
|
@ -227,7 +227,7 @@ export class KeywordsExpressions {
|
|||
($0, $1, $2) => {
|
||||
let tableName = /\s*FROM\s*(\w+\$*)/.exec($2)[1];
|
||||
let sql = `SELECT ${$2}`.replace(tableName, '?');
|
||||
return `${$1} = await sys.executeSQL({pid: pid, data:${tableName}, sql:"${sql}"})\n`;
|
||||
return `${$1} = await sys.executeSQL({pid: pid, data:${tableName}, sql:\`${sql}\`})\n`;
|
||||
}
|
||||
];
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
import { GBLog, IGBInstance } from 'botlib';
|
||||
import { GuaribasLog } from '../models/GBModel.js';
|
||||
import { GBServer } from '../../../src/app.js';
|
||||
|
||||
export class GBLogEx {
|
||||
public static async error(minOrInstanceId: any, message: string) {
|
||||
|
@ -81,7 +82,7 @@ export class GBLogEx {
|
|||
message = message ? message.substring(0, 1023) : null;
|
||||
|
||||
return await GuaribasLog.create(<GuaribasLog>{
|
||||
instanceId: instance ? instance.instanceId : 1,
|
||||
instanceId: instance ? instance.instanceId : GBServer.globals,
|
||||
message: message,
|
||||
kind: kind
|
||||
});
|
||||
|
|
20
src/app.ts
20
src/app.ts
|
@ -53,9 +53,7 @@ import { GBDeployer } from '../packages/core.gbapp/services/GBDeployer.js';
|
|||
import { GBImporter } from '../packages/core.gbapp/services/GBImporterService.js';
|
||||
import { GBMinService } from '../packages/core.gbapp/services/GBMinService.js';
|
||||
import auth from 'basic-auth';
|
||||
import { ChatGPTAPIBrowser } from 'chatgpt';
|
||||
import child_process from 'child_process';
|
||||
import * as winston from 'winston-logs-display';
|
||||
import { RootData } from './RootData.js';
|
||||
import { GBSSR } from '../packages/core.gbapp/services/GBSSR.js';
|
||||
import { Mutex } from 'async-mutex';
|
||||
|
@ -234,24 +232,6 @@ export class GBServer {
|
|||
GBServer.globals.minService = minService;
|
||||
await minService.buildMin(instances);
|
||||
|
||||
if (process.env.OPENAI_EMAIL) {
|
||||
if (!GBServer.globals.chatGPT) {
|
||||
GBServer.globals.chatGPT = new ChatGPTAPIBrowser({
|
||||
email: process.env.OPENAI_EMAIL,
|
||||
password: process.env.OPENAI_PASSWORD,
|
||||
markdown: false
|
||||
});
|
||||
await GBServer.globals.chatGPT.init();
|
||||
}
|
||||
}
|
||||
|
||||
if (process.env.ENABLE_WEBLOG) {
|
||||
// If global log enabled, reorders transports adding web logging.
|
||||
|
||||
const loggers = GBLog.getLogger();
|
||||
winston.default(server, loggers[1]);
|
||||
}
|
||||
|
||||
|
||||
server.all('*', async (req, res, next) => {
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue