🔄 refactor: Consolidate Ask/Edit Controllers (#1365)

* refactor(Ask/Edit): consolidate ask/edit controllers between the main modules and openAI controllers to reduce repetition of code and increase reusability

* fix(winston/logger): circular dependency issue

* fix(config/scripts): fix script imports

* refactor(indexSync): make not configured message an info log message

* chore: create a rollup script for api/server/index.js to check circular dependencies

* chore: bump @keyv/redis
This commit is contained in:
Danny Avila 2023-12-15 15:47:40 -05:00 committed by GitHub
parent 0958db3825
commit 509b1e5c63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 299 additions and 368 deletions

View file

@ -2,7 +2,6 @@ const path = require('path');
const winston = require('winston');
require('winston-daily-rotate-file');
const { redact, deepObjectFormat } = require('./parsers');
const { isEnabled } = require('~/server/utils/handleText');
const logDir = path.join(__dirname, '..', 'logs');
@ -67,7 +66,10 @@ const transports = [
// );
// }
if (isEnabled && isEnabled(DEBUG_LOGGING)) {
if (
(typeof DEBUG_LOGGING === 'string' && DEBUG_LOGGING?.toLowerCase() === 'true') ||
DEBUG_LOGGING === true
) {
transports.push(
new winston.transports.DailyRotateFile({
level: 'debug',
@ -88,7 +90,10 @@ const consoleFormat = winston.format.combine(
winston.format.printf((info) => `${info.timestamp} ${info.level}: ${info.message}`),
);
if (isEnabled && isEnabled(DEBUG_CONSOLE)) {
if (
(typeof DEBUG_CONSOLE === 'string' && DEBUG_CONSOLE?.toLowerCase() === 'true') ||
DEBUG_CONSOLE === true
) {
transports.push(
new winston.transports.Console({
level: 'debug',