Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for capitalized file extensions such as PDF #146

Merged
merged 1 commit into from
May 25, 2023

Conversation

shuruheel
Copy link
Contributor

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.

@vercel
Copy link

vercel bot commented May 24, 2023

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

@StanGirard first needs to authorize it.

@StanGirard StanGirard merged commit 7adcdd3 into QuivrHQ:main May 25, 2023
1 check failed
@shuruheel shuruheel deleted the cap-ext-support branch June 1, 2023 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants