You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@router.post("/files", response_model=FileObject)asyncdefcreate_file(
file: UploadFile=File(...),
purpose: Literal["fine-tune", "assistants"] =File(...),
db: Session=Depends(get_db),
minio_client: Minio=Depends(minio_client),
):
ifpurposenotin ["fine-tune", "assistants"]:
raiseHTTPException(status_code=400, detail="Invalid purpose")
# Ensure file data is read before any operation that might exhaust the streamfile_data_bytes=awaitfile.read()
# Check if file data is emptyifnotfile_data_bytes:
raiseHTTPException(status_code=400, detail="File is empty")
uploaded_file=actions.upload_file(
minio_client=minio_client, bucket_name=BUCKET_NAME, file=file
)
crud.create_file(db=db, file=uploaded_file)
# # File data is passed here after ensuring it's not empty# wv_actions.upload_file_chunks(# file_data=file_data_bytes,# file_name=file.filename,# file_id=uploaded_file.id,# )returnuploaded_file
The text was updated successfully, but these errors were encountered:
Entry point to address this issue:
The text was updated successfully, but these errors were encountered: