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'
|
mime_type = mime_type or 'application/octet-stream'
|
||||||
|
|
||||||
with open(file_path, 'rb') as f:
|
with open(file_path, 'rb') as f:
|
||||||
files = {
|
file_content = f.read()
|
||||||
'files': (os.path.basename(file_path), f, mime_type)
|
|
||||||
}
|
files = {
|
||||||
|
'files': (os.path.basename(file_path), io.BytesIO(file_content), mime_type)
|
||||||
|
}
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
'image_export_mode': 'inline',
|
'image_export_mode': 'inline',
|
||||||
|
|||||||
Reference in New Issue
Block a user