mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-26 12:24:10 +01:00
🔃 refactor: Decouple Effects from AppService, move to data-schemas (#9974)
* chore: linting for `loadCustomConfig` * refactor: decouple CDN init and variable/health checks from AppService * refactor: move AppService to packages/data-schemas * chore: update AppConfig import path to use data-schemas * chore: update JsonSchemaType import path to use data-schemas * refactor: update UserController to import webSearchKeys and redefine FunctionTool typedef * chore: remove AppService.js * refactor: update AppConfig interface to use Partial<TCustomConfig> and make paths and fileStrategies optional * refactor: update checkConfig function to accept Partial<TCustomConfig> * chore: fix types * refactor: move handleRateLimits to startup checks as is an effect * test: remove outdated rate limit tests from AppService.spec and add new handleRateLimits tests in checks.spec
This commit is contained in:
parent
9ff608e6af
commit
838fb53208
73 changed files with 1383 additions and 1326 deletions
26
packages/api/src/app/cdn.ts
Normal file
26
packages/api/src/app/cdn.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { logger } from '@librechat/data-schemas';
|
||||
import { FileSources } from 'librechat-data-provider';
|
||||
import type { AppConfig } from '@librechat/data-schemas';
|
||||
import { initializeAzureBlobService } from '~/cdn/azure';
|
||||
import { initializeFirebase } from '~/cdn/firebase';
|
||||
import { initializeS3 } from '~/cdn/s3';
|
||||
|
||||
/**
|
||||
* Initializes file storage clients based on the configured file strategy.
|
||||
* This should be called after loading the app configuration.
|
||||
* @param {Object} options
|
||||
* @param {AppConfig} options.appConfig - The application configuration
|
||||
*/
|
||||
export function initializeFileStorage(appConfig: AppConfig) {
|
||||
const { fileStrategy } = appConfig;
|
||||
|
||||
if (fileStrategy === FileSources.firebase) {
|
||||
initializeFirebase();
|
||||
} else if (fileStrategy === FileSources.azure_blob) {
|
||||
initializeAzureBlobService().catch((error) => {
|
||||
logger.error('Error initializing Azure Blob Service:', error);
|
||||
});
|
||||
} else if (fileStrategy === FileSources.s3) {
|
||||
initializeS3();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue