fix(kreuzberg): fix 'read of closed file' error by reading file content before requests
This commit is contained in:
@@ -73,9 +73,11 @@ class Tools:
|
||||
mime_type = mime_type or 'application/octet-stream'
|
||||
|
||||
with open(file_path, 'rb') as f:
|
||||
files = {
|
||||
'files': (os.path.basename(file_path), f, mime_type)
|
||||
}
|
||||
file_content = f.read()
|
||||
|
||||
files = {
|
||||
'files': (os.path.basename(file_path), io.BytesIO(file_content), mime_type)
|
||||
}
|
||||
|
||||
data = {
|
||||
'image_export_mode': 'inline',
|
||||
|
||||
Reference in New Issue
Block a user