📂 refactor: File Read Operations (#9747)

* fix: axios response logging for text parsing, remove console logging, remove jsdoc

* refactor: error logging in logAxiosError function to handle various error types with type guards

* refactor: enhance text parsing with improved error handling and async file reading

* refactor: replace synchronous file reading with asynchronous methods for improved performance and memory management

* ci: update tests
This commit is contained in:
Danny Avila 2025-09-20 10:17:24 -04:00 committed by GitHub
parent 0352067da2
commit 2489670f54
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 692 additions and 83 deletions

View file

@ -1,7 +1,7 @@
import fs from 'fs';
import path from 'path';
import axios from 'axios';
import { logger } from '@librechat/data-schemas';
import { readFileAsString } from './files';
export interface GoogleServiceKey {
type?: string;
@ -63,7 +63,7 @@ export async function loadServiceKey(keyPath: string): Promise<GoogleServiceKey
// It's a file path
try {
const absolutePath = path.isAbsolute(keyPath) ? keyPath : path.resolve(keyPath);
const fileContent = fs.readFileSync(absolutePath, 'utf8');
const { content: fileContent } = await readFileAsString(absolutePath);
serviceKey = JSON.parse(fileContent);
} catch (error) {
logger.error(`Failed to load service key from file: ${keyPath}`, error);