Skip to content

Commit

Permalink
Merge pull request #17 from K3A-Team/extensions-handling
Browse files Browse the repository at this point in the history
better handling for none treated extensions
  • Loading branch information
4zz0u4k authored Aug 18, 2024
2 parents 0297aee + 1f0a051 commit 28fa639
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions code/services/upsertService.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
from langchain_openai import OpenAIEmbeddings
from docx import Document

ROWS_FOR_ONE_CHUNCK= 20
ROWS_FOR_ONE_CHUNCK = 20
SUPPORTED_EXTENSIONS = ['.csv','.xlsx','.docx','.pdf','.txt']

pc = Pinecone(api_key=os.getenv('PINECONE_API_KEY'))

Expand Down Expand Up @@ -115,7 +116,9 @@ async def process_and_upsert_service(file,name,file_id,url,userID):

# Upserting the file's content
file_ext = os.path.splitext(file.filename)[1].lower()

if (file_ext not in SUPPORTED_EXTENSIONS):
# No upserting (for the moment)
return
if(file_ext == '.csv' or file_ext == '.xlsx' ):
# Upserting rows
rows,page_content = await read_style_sheet(file)
Expand Down

0 comments on commit 28fa639

Please sign in to comment.