quivr icon indicating copy to clipboard operation
quivr copied to clipboard

Support for capitalized file extensions such as PDF

Open shuruheel opened this issue 1 year ago • 1 comments

GPT-4: To allow capitalized file extensions, you can convert the file extension to lowercase before checking it against the file_processors dictionary in the filter_file function. Here's the modified filter_file function in the api.py file:

async def filter_file(file: UploadFile, enable_summarization: bool, supabase_client: Client):
    if await file_already_exists(supabase_client, file):
        return {"message": f"🤔 {file.filename} already exists.", "type": "warning"}
    elif file.file._file.tell() < 1:
        return {"message": f"❌ {file.filename} is empty.", "type": "error"}
    else:
        file_extension = os.path.splitext(file.filename)[-1].lower()  # Convert file extension to lowercase
        if file_extension in file_processors:
            await file_processors[file_extension](file, enable_summarization)
            return {"message": f"✅ {file.filename} has been uploaded.", "type": "success"}
        else:
            return {"message": f"❌ {file.filename} is not supported.", "type": "error"}

This change will ensure that capitalized file extensions are treated the same as their lowercase counterparts when checking against the file_processors dictionary.

shuruheel avatar May 24 '23 19:05 shuruheel

Someone is attempting to deploy a commit to a Personal Account owned by @StanGirard on Vercel.

@StanGirard first needs to authorize it.

vercel[bot] avatar May 24 '23 19:05 vercel[bot]