@@ -183,14 +183,14 @@ async def convert_to_base64(self) -> str:
183183 if not self .file :
184184 raise Exception (f"not a valid file: { self .file } " )
185185 if self .file .startswith ("file:///" ):
186- bs64_data = file_to_base64 (self .file [8 :])
186+ bs64_data = await file_to_base64 (self .file [8 :])
187187 elif self .file .startswith ("http" ):
188188 file_path = await download_image_by_url (self .file )
189- bs64_data = file_to_base64 (file_path )
189+ bs64_data = await file_to_base64 (file_path )
190190 elif self .file .startswith ("base64://" ):
191191 bs64_data = self .file
192192 elif await asyncio .to_thread (os .path .exists , self .file ):
193- bs64_data = file_to_base64 (self .file )
193+ bs64_data = await file_to_base64 (self .file )
194194 else :
195195 raise Exception (f"not a valid file: { self .file } " )
196196 bs64_data = bs64_data .removeprefix ("base64://" )
@@ -474,14 +474,14 @@ async def convert_to_base64(self) -> str:
474474 if not url :
475475 raise ValueError ("No valid file or URL provided" )
476476 if url .startswith ("file:///" ):
477- bs64_data = file_to_base64 (url [8 :])
477+ bs64_data = await file_to_base64 (url [8 :])
478478 elif url .startswith ("http" ):
479479 image_file_path = await download_image_by_url (url )
480- bs64_data = file_to_base64 (image_file_path )
480+ bs64_data = await file_to_base64 (image_file_path )
481481 elif url .startswith ("base64://" ):
482482 bs64_data = url
483483 elif await asyncio .to_thread (os .path .exists , url ):
484- bs64_data = file_to_base64 (url )
484+ bs64_data = await file_to_base64 (url )
485485 else :
486486 raise Exception (f"not a valid file: { url } " )
487487 bs64_data = bs64_data .removeprefix ("base64://" )
0 commit comments