diff --git a/api/server/routes/files/files.js b/api/server/routes/files/files.js index dc6c99b29b..8fe5eb70d4 100644 --- a/api/server/routes/files/files.js +++ b/api/server/routes/files/files.js @@ -69,9 +69,10 @@ router.delete('/', async (req, res) => { await processDeleteRequest({ req, files }); logger.debug( - `[/files] Files deleted successfully: ${files.map( - (f, i) => `${f.file_id}${i < files.length - 1 ? ', ' : ''}`, - )}`, + `[/files] Files deleted successfully: ${files + .filter((f) => f.file_id) + .map((f) => f.file_id) + .join(', ')}`, ); res.status(200).json({ message: 'Files deleted successfully' }); } catch (error) { @@ -220,7 +221,7 @@ router.post('/', async (req, res) => { try { await fs.unlink(file.path); } catch (error) { - logger.error('[/files/images] Error deleting file after file processing:', error); + logger.error('[/files] Error deleting file after file processing:', error); } } }); diff --git a/client/src/components/Chat/Input/ChatForm.tsx b/client/src/components/Chat/Input/ChatForm.tsx index 412983c010..fafa17c34d 100644 --- a/client/src/components/Chat/Input/ChatForm.tsx +++ b/client/src/components/Chat/Input/ChatForm.tsx @@ -8,9 +8,9 @@ import { } from 'librechat-data-provider'; import { useChatContext, + useChatFormContext, useAddedChatContext, useAssistantsMapContext, - useChatFormContext, } from '~/Providers'; import { useTextarea, @@ -20,18 +20,17 @@ import { useQueryParams, useSubmitMessage, } from '~/hooks'; +import FileFormWrapper from './Files/FileFormWrapper'; import { TextareaAutosize } from '~/components/ui'; import { useGetFileConfig } from '~/data-provider'; import { cn, removeFocusRings } from '~/utils'; import TextareaHeader from './TextareaHeader'; import PromptsCommand from './PromptsCommand'; -import AttachFile from './Files/AttachFile'; import AudioRecorder from './AudioRecorder'; import { mainTextareaId } from '~/common'; import StreamAudio from './StreamAudio'; import StopButton from './StopButton'; import SendButton from './SendButton'; -import FileRow from './Files/FileRow'; import Mention from './Mention'; import store from '~/store'; @@ -73,7 +72,6 @@ const ChatForm = ({ index = 0 }) => { conversation, isSubmitting, filesLoading, - setFilesLoading, newConversation, handleStopGenerating, } = useChatContext(); @@ -130,6 +128,9 @@ const ChatForm = ({ index = 0 }) => { } }, [isSearching, disableInputs]); + const endpointSupportsFiles: boolean = supportsFiles[endpointType ?? endpoint ?? ''] ?? false; + const isUploadDisabled: boolean = endpointFileConfig?.disabled ?? false; + return (