mirror of
https://github.com/imartinez/privateGPT.git
synced 2025-07-02 02:03:01 +00:00
Try catch added on ingest
This commit is contained in:
parent
a8a10e412e
commit
484b6b7223
@ -294,6 +294,7 @@ async def common_ingest_logic(
|
|||||||
)
|
)
|
||||||
# Handling Original File
|
# Handling Original File
|
||||||
if original_file:
|
if original_file:
|
||||||
|
try:
|
||||||
print("ORIGINAL PDF FILE PATH IS :: ", original_file)
|
print("ORIGINAL PDF FILE PATH IS :: ", original_file)
|
||||||
file_name = Path(original_file).name
|
file_name = Path(original_file).name
|
||||||
upload_path = Path(f"{UPLOAD_DIR}/{file_name}")
|
upload_path = Path(f"{UPLOAD_DIR}/{file_name}")
|
||||||
@ -322,6 +323,13 @@ async def common_ingest_logic(
|
|||||||
|
|
||||||
with open(upload_path, "rb") as f:
|
with open(upload_path, "rb") as f:
|
||||||
ingested_documents = service.ingest_bin_data(file_name, f)
|
ingested_documents = service.ingest_bin_data(file_name, f)
|
||||||
|
except Exception as e:
|
||||||
|
print(traceback.print_exc())
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=500,
|
||||||
|
detail="Internal Server Error: Unable to ingest file.",
|
||||||
|
)
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
f"{file_name} is uploaded by the {current_user.fullname}.")
|
f"{file_name} is uploaded by the {current_user.fullname}.")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user