mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-24 04:10:15 +01:00
fix: type guard for compiler
This commit is contained in:
parent
0a61e3cb39
commit
5b38ce8fd9
1 changed files with 8 additions and 8 deletions
|
|
@ -10,20 +10,20 @@ interface PromptFilesPreviewProps {
|
|||
|
||||
const PromptFilesPreview: React.FC<PromptFilesPreviewProps> = ({ toolResources }) => {
|
||||
const localize = useLocalize();
|
||||
const { data: allFiles = [] } = useGetFiles();
|
||||
const { data: allFiles } = useGetFiles();
|
||||
|
||||
// Create a fileMap for quick lookup
|
||||
const fileMap = useMemo(() => {
|
||||
const map: Record<string, any> = {};
|
||||
allFiles.forEach((file) => {
|
||||
if (file.file_id) {
|
||||
map[file.file_id] = file;
|
||||
}
|
||||
});
|
||||
if (Array.isArray(allFiles)) {
|
||||
allFiles.forEach((file) => {
|
||||
if (file.file_id) {
|
||||
map[file.file_id] = file;
|
||||
}
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}, [allFiles]);
|
||||
|
||||
// Extract all file IDs from tool resources
|
||||
const attachedFiles = useMemo(() => {
|
||||
const files: Array<{ file: any; toolResource: string }> = [];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue