mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-03-06 08:10:17 +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 PromptFilesPreview: React.FC<PromptFilesPreviewProps> = ({ toolResources }) => {
|
||||||
const localize = useLocalize();
|
const localize = useLocalize();
|
||||||
const { data: allFiles = [] } = useGetFiles();
|
const { data: allFiles } = useGetFiles();
|
||||||
|
|
||||||
// Create a fileMap for quick lookup
|
|
||||||
const fileMap = useMemo(() => {
|
const fileMap = useMemo(() => {
|
||||||
const map: Record<string, any> = {};
|
const map: Record<string, any> = {};
|
||||||
allFiles.forEach((file) => {
|
if (Array.isArray(allFiles)) {
|
||||||
if (file.file_id) {
|
allFiles.forEach((file) => {
|
||||||
map[file.file_id] = file;
|
if (file.file_id) {
|
||||||
}
|
map[file.file_id] = file;
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
return map;
|
return map;
|
||||||
}, [allFiles]);
|
}, [allFiles]);
|
||||||
|
|
||||||
// Extract all file IDs from tool resources
|
|
||||||
const attachedFiles = useMemo(() => {
|
const attachedFiles = useMemo(() => {
|
||||||
const files: Array<{ file: any; toolResource: string }> = [];
|
const files: Array<{ file: any; toolResource: string }> = [];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue