From f95e17c047d533170edd279b9e441f3ac5d6785c Mon Sep 17 00:00:00 2001 From: Faisal Amir Date: Thu, 14 Aug 2025 13:54:17 +0700 Subject: [PATCH] chore: disable pdf for local model --- web-app/src/containers/ChatInput.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/web-app/src/containers/ChatInput.tsx b/web-app/src/containers/ChatInput.tsx index e711804a8..5d1d2b300 100644 --- a/web-app/src/containers/ChatInput.tsx +++ b/web-app/src/containers/ChatInput.tsx @@ -226,17 +226,20 @@ const ChatInput = ({ model, className, initialMessage }: ChatInputProps) => { const detectedType = file.type || getFileTypeFromExtension(file.name) const actualType = getFileTypeFromExtension(file.name) || detectedType - // Check file type + // Check file type - exclude PDF for local models (llamacpp) const allowedTypes = [ 'image/jpg', 'image/jpeg', 'image/png', - 'application/pdf', + ...(model?.provider !== 'llamacpp' ? ['application/pdf'] : []), ] if (!allowedTypes.includes(actualType)) { + const supportedFormats = model?.provider === 'llamacpp' + ? 'JPEG, JPG, and PNG' + : 'JPEG, JPG, PNG, and PDF' setMessage( - `File is not supported. Only JPEG, JPG, PNG, and PDF files are allowed.` + `File is not supported. Only ${supportedFormats} files are allowed.` ) // Reset file input to allow re-uploading if (fileInputRef.current) {