mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 03:32:23 +08:00
fix azure stream download (#6063)
This commit is contained in:
parent
603187393a
commit
cbbe28f40d
|
@ -1,5 +1,4 @@
|
|||
from collections.abc import Generator
|
||||
from contextlib import closing
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
||||
from azure.storage.blob import AccountSasPermissions, BlobServiceClient, ResourceTypes, generate_account_sas
|
||||
|
@ -38,10 +37,9 @@ class AzureStorage(BaseStorage):
|
|||
|
||||
def generate(filename: str = filename) -> Generator:
|
||||
blob = client.get_blob_client(container=self.bucket_name, blob=filename)
|
||||
with closing(blob.download_blob()) as blob_stream:
|
||||
while chunk := blob_stream.readall():
|
||||
yield chunk
|
||||
|
||||
blob_data = blob.download_blob()
|
||||
for chunk in blob_data.chunks():
|
||||
yield from chunk
|
||||
return generate()
|
||||
|
||||
def download(self, filename, target_filepath):
|
||||
|
|
Loading…
Reference in New Issue
Block a user