mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-29 14:48:51 +01:00
24 lines
571 B
TypeScript
24 lines
571 B
TypeScript
|
|
import type { TFile, Assistant } 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;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Maps Assistants by `id` for quick lookup */
|
||
|
|
export function mapAssistants(assistants: Assistant[]) {
|
||
|
|
const assistantMap = {} as Record<string, Assistant>;
|
||
|
|
|
||
|
|
for (const assistant of assistants) {
|
||
|
|
assistantMap[assistant.id] = assistant;
|
||
|
|
}
|
||
|
|
|
||
|
|
return assistantMap;
|
||
|
|
}
|