mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 17:30:16 +01:00
13 lines
283 B
TypeScript
13 lines
283 B
TypeScript
|
|
import type { TFile } from 'librechat-data-provider';
|
||
|
|
|
||
|
|
/** Maps Files by `file_id` for quick lookup */
|
||
|
|
export function mapFiles(files: TFile[]) {
|
||
|
|
const fileMap = {} as Record<string, TFile>;
|
||
|
|
|
||
|
|
for (const file of files) {
|
||
|
|
fileMap[file.file_id] = file;
|
||
|
|
}
|
||
|
|
|
||
|
|
return fileMap;
|
||
|
|
}
|